remove namespace Cairo from all header

This commit is contained in:
houzh 2022-11-06 23:49:41 +00:00
parent 65eb0066fe
commit ea462ec793
74 changed files with 309 additions and 81 deletions

View File

@ -20,7 +20,8 @@ add_custom_target(build_app_examples COMMENT A target that requires all the exam
if(NOT ENABLE_PLPLOT)
list(REMOVE_ITEM ExamplesFileList plot.cc)
endif()
add_definitions(--include cdtypes.h)
add_definitions(--include cdlog.h)
foreach(Example ${ExamplesFileList})
message(STATUS "\tCreating build rule for ${Example}")
# Get the name without extension or directory

View File

@ -9,7 +9,7 @@
#include<animations.h>
#include<drawables.h>
#include<cdlog.h>
using namespace Cairo;
class MyAdapter:public ArrayAdapter<std::string>{
public:
MyAdapter():ArrayAdapter(){

View File

@ -1,6 +1,6 @@
#include <cdroid.h>
#include <dirent.h>
using namespace Cairo;
int main(int argc,const char*argv[]){
App app(argc,argv);
Window*w=new Window(0,0,1280,600);

View File

@ -1,7 +1,7 @@
#include <cdroid.h>
#include <dirent.h>
#include <widget/pagetransformers.h>
using namespace Cairo;
class MyPageAdapter:public PagerAdapter{
std::vector<std::string>urls;
std::map< int,RefPtr<Cairo::ImageSurface> >imgs;

View File

@ -15,6 +15,8 @@ include_directories(
${DEPS_DIR}/include/freetype2
)
aux_source_directory(./ DEMO_SRCS)
add_definitions(--include cdtypes.h)
add_definitions(--include cdlog.h)
link_directories(${DEPS_DIR}/lib)
add_executable(uidemo1 ${DEMO_SRCS})

17
apps/uidemo1/nm1.h Normal file
View File

@ -0,0 +1,17 @@
#ifndef __NM__1_H__
#define __NM__1_H__
namespace n2{
class test2;
}
namespace n1{
class test1{
private:
friend n2::test2;
struct Student{
char *name;
};
Student a;
};
};
#endif

10
apps/uidemo1/nm2.cc Normal file
View File

@ -0,0 +1,10 @@
#include <nm2.h>
#include <nm1.h>
namespace n2{
test2::test2(){
n1::test1 tt;
tt.a.name="test";
}
}

11
apps/uidemo1/nm2.h Normal file
View File

@ -0,0 +1,11 @@
#ifndef __NM2_H__
#define __NM2_H__
namespace n2{
class test2{
private:
test2();
};
}
#endif

View File

@ -14,6 +14,8 @@ include_directories(
${DEPS_DIR}/include/epg
${DEPS_DIR}/include/freetype2
)
add_definitions(--include cdtypes.h)
add_definitions(--include cdlog.h)
aux_source_directory(./ DEMO_SRCS)
link_directories(${DEPS_DIR}/lib)
add_executable(uidemo2 ${DEMO_SRCS})

75
cmake/modules/FindCairo.cmake Executable file
View File

@ -0,0 +1,75 @@
# - Try to find Cairo
# Once done, this will define
#
# CAIRO_FOUND - system has Cairo
# CAIRO_INCLUDE_DIRS - the Cairo include directories
# CAIRO_LIBRARIES - link these to use Cairo
#
# Copyright (C) 2012 Raphael Kubo da Costa <rakuco@webkit.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS
# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
find_package(PkgConfig)
pkg_check_modules(PC_CAIRO QUIET cairo)
find_path(CAIRO_INCLUDE_DIRS
NAMES cairo.h
HINTS ${PC_CAIRO_INCLUDEDIR}
${PC_CAIRO_INCLUDE_DIRS}
PATH_SUFFIXES cairo
)
find_library(CAIRO_LIBRARIES
NAMES cairo
HINTS ${PC_CAIRO_LIBDIR}
${PC_CAIRO_LIBRARY_DIRS}
)
if (CAIRO_INCLUDE_DIRS)
if (EXISTS "${CAIRO_INCLUDE_DIRS}/cairo-version.h")
file(READ "${CAIRO_INCLUDE_DIRS}/cairo-version.h" CAIRO_VERSION_CONTENT)
string(REGEX MATCH "#define +CAIRO_VERSION_MAJOR +([0-9]+)" _dummy "${CAIRO_VERSION_CONTENT}")
set(CAIRO_VERSION_MAJOR "${CMAKE_MATCH_1}")
string(REGEX MATCH "#define +CAIRO_VERSION_MINOR +([0-9]+)" _dummy "${CAIRO_VERSION_CONTENT}")
set(CAIRO_VERSION_MINOR "${CMAKE_MATCH_1}")
string(REGEX MATCH "#define +CAIRO_VERSION_MICRO +([0-9]+)" _dummy "${CAIRO_VERSION_CONTENT}")
set(CAIRO_VERSION_MICRO "${CMAKE_MATCH_1}")
set(CAIRO_VERSION "${CAIRO_VERSION_MAJOR}.${CAIRO_VERSION_MINOR}.${CAIRO_VERSION_MICRO}")
endif ()
endif ()
if ("${Cairo_FIND_VERSION}" VERSION_GREATER "${CAIRO_VERSION}")
message(FATAL_ERROR "Required version (" ${Cairo_FIND_VERSION} ") is higher than found version (" ${CAIRO_VERSION} ")")
endif ()
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Cairo REQUIRED_VARS CAIRO_INCLUDE_DIRS CAIRO_LIBRARIES
VERSION_VAR CAIRO_VERSION)
mark_as_advanced(
CAIRO_INCLUDE_DIRS
CAIRO_LIBRARIES
)

View File

@ -0,0 +1,88 @@
# Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
find_package(PkgConfig)
pkg_check_modules(PC_FREETYPE2 REQUIRED freetype2)
find_path(FREETYPE2_HEADER_DIR
NAMES freetype.h
HINTS ${PC_FREETYPE2_INCLUDE_DIRS}
${PC_FREETYPE2_INCLUDEDIR}
PATH_SUFFIXES freetype
)
find_path(FREETYPE2_ROOT_INCLUDE_DIR
NAMES freetype/freetype.h
HINTS ${PC_FREETYPE2_INCLUDE_DIRS}
${PC_FREETYPE2_INCLUDEDIR}
)
find_library(FREETYPE2_LIBRARIES
NAMES freetype
HINTS ${PC_FREETYPE2_LIBDIR}
${PC_FREETYPE2_LIBRARY_DIRS}
)
set(FREETYPE2_INCLUDE_DIRS ${FREETYPE2_HEADER_DIR})
# Since Freetype 2.5.1 there is no freetype/freetype.h, so this variable can be null
if (FREETYPE2_ROOT_INCLUDE_DIR)
list(APPEND FREETYPE2_INCLUDE_DIRS ${FREETYPE2_ROOT_INCLUDE_DIR})
endif ()
# Inspired in the original FindFreetype.cmake
if (FREETYPE2_HEADER_DIR AND EXISTS "${FREETYPE2_HEADER_DIR}/freetype.h")
file(STRINGS "${FREETYPE2_HEADER_DIR}/freetype.h" freetype_version_str
REGEX "^#[\t ]*define[\t ]+FREETYPE_(MAJOR|MINOR|PATCH)[\t ]+[0-9]+$")
unset(FREETYPE2_VERSION_STRING)
foreach (VPART MAJOR MINOR PATCH)
foreach (VLINE ${freetype_version_str})
if (VLINE MATCHES "^#[\t ]*define[\t ]+FREETYPE_${VPART}")
string(REGEX REPLACE "^#[\t ]*define[\t ]+FREETYPE_${VPART}[\t ]+([0-9]+)$" "\\1"
FREETYPE2_VERSION_PART "${VLINE}")
if (FREETYPE2_VERSION_STRING)
set(FREETYPE2_VERSION_STRING "${FREETYPE2_VERSION_STRING}.${FREETYPE2_VERSION_PART}")
else ()
set(FREETYPE2_VERSION_STRING "${FREETYPE2_VERSION_PART}")
endif ()
unset(FREETYPE2_VERSION_PART)
endif ()
endforeach ()
endforeach ()
endif ()
set(VERSION_OK TRUE)
if (FREETYPE2_VERSION_STRING)
if (PC_FREETYPE2_FIND_VERSION_EXACT)
if (NOT("${Freetype2_FIND_VERSION}" VERSION_EQUAL "${FREETYPE2_VERSION_STRING}"))
set(VERSION_OK FALSE)
endif ()
else ()
if ("${FREETYPE2_VERSION_STRING}" VERSION_LESS "${Freetype2_FIND_VERSION}")
set(VERSION_OK FALSE)
endif ()
endif ()
endif ()
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Freetype2 DEFAULT_MSG FREETYPE2_INCLUDE_DIRS FREETYPE2_LIBRARIES VERSION_OK)

View File

@ -157,7 +157,7 @@ endif()
if(SIZEOF_UINT128_T)
set(HAVE_UINT128_T 1)
endif()
if(SIZEOF_UINT64_T)
if(TRUE)##SIZEOF_UINT64_T)
set(HAVE_UINT64_T 1)
endif()

View File

@ -44,7 +44,8 @@ if(NOT PNG_BUILD_ZLIB)
endif()
if(UNIX AND NOT APPLE AND NOT BEOS AND NOT HAIKU)
find_library(M_LIBRARY m)
set(M_LIBRARY "m")
#find_library(M_LIBRARY "m")
else()
# libm is not needed and/or not available
set(M_LIBRARY "")
@ -63,7 +64,6 @@ set(PNG_PREFIX "" CACHE STRING "Prefix to add to the API function names")
set(DFA_XTRA "" CACHE FILEPATH "File containing extra configuration settings")
if(PNG_HARDWARE_OPTIMIZATIONS)
# set definitions and sources for arm
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm" OR
CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64")
@ -489,6 +489,8 @@ set(libpng_sources
${libpng_mips_sources}
${libpng_powerpc_sources}
)
if (FALSE)
set(pngtest_sources
pngtest.c
)
@ -510,6 +512,7 @@ set(pngfix_sources
set(png_fix_itxt_sources
contrib/tools/png-fix-itxt.c
)
endif()
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
@ -746,13 +749,13 @@ if(BUILD_TESTS AND PNG_SHARED)
endif()
if(PNG_SHARED)
add_executable(pngfix ${pngfix_sources})
target_link_libraries(pngfix png)
set(PNG_BIN_TARGETS pngfix)
#add_executable(pngfix ${pngfix_sources})
#target_link_libraries(pngfix png)
#set(PNG_BIN_TARGETS pngfix)
add_executable(png-fix-itxt ${png_fix_itxt_sources})
target_link_libraries(png-fix-itxt ${ZLIB_LIBRARY} ${M_LIBRARY})
list(APPEND PNG_BIN_TARGETS png-fix-itxt)
#add_executable(png-fix-itxt ${png_fix_itxt_sources})
#target_link_libraries(png-fix-itxt ${ZLIB_LIBRARY} ${M_LIBRARY})
#list(APPEND PNG_BIN_TARGETS png-fix-itxt)
endif()
# Set a variable with CMake code which:

View File

@ -26,6 +26,7 @@ include_directories(
./core/svg ./luabinding
${CMAKE_BINARY_DIR}/include
${PNG_INCLUDE_DIRS} ${FREETYPE_INCLUDE_DIR} ${PLPLOT_INCLUDE_DIR}
${CMAKE_BINARY_DIR}/include/gui
${CMAKE_BINARY_DIR}/include/pixman
${CMAKE_BINARY_DIR}/include/cairo
${CMAKE_BINARY_DIR}/include/porting
@ -41,7 +42,8 @@ include_directories(
)
add_definitions(-DRAPIDJSON_HAS_STDSTRING)
add_definitions(--include cdtypes.h)
add_definitions(--include cdlog.h)
set(SOURCES_GUI ${SRCS_GUICORE} ${SRCS_VIEWS}
${SRCS_CAIROMM} ${SRCS_WIDGET} ${SRCS_DRAWABLES}

View File

@ -5,6 +5,7 @@
#include <cdtypes.h>
#include <cdlog.h>
using namespace Cairo;
namespace cdroid{
Animation::Animation() {

View File

@ -1,4 +1,5 @@
#include <animation/propertyvaluesholder.h>
#include "cdlog.h"
namespace cdroid{
PropertyValuesHolder::PropertyValuesHolder(){

View File

@ -7,7 +7,6 @@
#include <cmath>
#include <iostream>
#include <cdtypes.h>
#include <cdlog.h>
#include <core/color.h>
#include <core/variant.h>
//reference:

View File

@ -53,7 +53,7 @@
#include <jpeglib.h>
#include <turbojpeg.h>
#include "cairo_jpg.h"
#include <gui/gui_features.h>
#include <gui_features.h>
#include <istream>
#include <cdtypes.h>
#include <cdlog.h>

View File

@ -39,7 +39,7 @@
#include <cairomm/device.h>
#include <cairomm/fontoptions.h>
#include <cairomm/refptr.h>
#include <gui/gui_features.h>
#include <gui_features.h>
//See xlib_surface.h for XlibSurface.
//See win32_surface.h for Win32Surface.
@ -271,9 +271,9 @@ public:
* in the middle 6 bits, and blue in the lower 5 bits
*/
RGB16_565 = CAIRO_FORMAT_RGB16_565,
RGB30 =CAIRO_FORMAT_RGB30 , /*like RGB24 but with 10bpc. (Since 1.12)*/
RGB96F = CAIRO_FORMAT_RGB96F, /*3 floats, R, G, B. (Since 1.17.2)*/
RGB128F = CAIRO_FORMAT_RGBA128F/*4 floats, R, G, B, A. (Since 1.17.2)*/
//RGB30 =CAIRO_FORMAT_RGB30 , /*like RGB24 but with 10bpc. (Since 1.12)*/
//RGB96F = CAIRO_FORMAT_RGB96F, /*3 floats, R, G, B. (Since 1.17.2)*/
//RGB128F = CAIRO_FORMAT_RGBA128F/*4 floats, R, G, B, A. (Since 1.17.2)*/
};
/** For example:
* <code>

View File

@ -8,7 +8,6 @@
#include <core/context.h>
#include <core/assets.h>
struct option;
using namespace Cairo;
namespace cdroid{

View File

@ -11,7 +11,7 @@
#include <textutils.h>
#include <expat.h>
#include <limits.h>
using namespace Cairo;
namespace cdroid{
Assets::Assets(){

View File

@ -44,7 +44,7 @@ public:
const DisplayMetrics&getDisplayMetrics()override;
int getId(const std::string&)const override;
const std::string& getString(const std::string&id,const std::string&lan="")override;
RefPtr<Cairo::ImageSurface> getImage(const std::string&resname)override;
Cairo::RefPtr<Cairo::ImageSurface> getImage(const std::string&resname)override;
std::vector<std::string> getStringArray(const std::string&resname,const std::string&arrayname)const;
std::unique_ptr<std::istream> getInputStream(const std::string&resname,std::string*outpkg=nullptr)override;
Drawable * getDrawable(const std::string&resid)override;

View File

@ -5,8 +5,7 @@
#include <cairomm/context.h>
#include <cairomm/region.h>
#include <core/graphdevice.h>
#include <gui/gui_features.h>
using namespace Cairo;
#include <gui_features.h>
namespace cdroid{
@ -29,7 +28,7 @@ protected:
friend class GraphDevice;
friend class WindowManager;
public:
Canvas(const RefPtr<Surface>&target);
Canvas(const Cairo::RefPtr<Cairo::Surface>&target);
Canvas(unsigned int width,unsigned int height);
~Canvas();
void get_text_size(const std::string&txt,int*w,int*h);
@ -38,11 +37,11 @@ public:
void set_color(UINT color);
void rectangle(int x,int y,int w,int h);
void rectangle(const RECT &r);
void draw_image(const RefPtr<ImageSurface>&img,const RECT&dst,const RECT*src);
void draw_image(const Cairo::RefPtr<Cairo::ImageSurface>&img,const RECT&dst,const RECT*src);
void rotate(float degrees,float px,float py);
void dump2png(const char*fname);
};
extern void DumpRegion(const std::string&label,RefPtr<Region>rgn);
extern void DumpRegion(const std::string&label,Cairo::RefPtr<Cairo::Region>rgn);
}//namspace
#endif

View File

@ -9,8 +9,6 @@
#include <core/attributeset.h>
#include <core/displaymetrics.h>
using namespace Cairo;
namespace cdroid{
class Drawable;
@ -22,11 +20,11 @@ public:
virtual const DisplayMetrics&getDisplayMetrics()=0;
virtual int getId(const std::string&)const=0;
virtual const std::string& getString(const std::string&id,const std::string&lan="")=0;
static RefPtr<Cairo::ImageSurface> loadImage( std::istream&istream ){
static Cairo::RefPtr<Cairo::ImageSurface> loadImage( std::istream&istream ){
return Cairo::ImageSurface::create_from_stream(istream);
}
virtual std::unique_ptr<std::istream>getInputStream(const std::string&,std::string*outpkg=nullptr)=0;
virtual RefPtr<Cairo::ImageSurface> getImage(const std::string&resname)=0;
virtual Cairo::RefPtr<Cairo::ImageSurface> getImage(const std::string&resname)=0;
virtual Drawable* getDrawable(const std::string&resid)=0;
Drawable* getDrawable(const AttributeSet&atts,const std::string&key){
return atts.hasAttribute(key)?getDrawable(atts.getString(key)):nullptr;

View File

@ -6,7 +6,6 @@
#include <condition_variable>
#include <map>
using namespace Cairo;
namespace cdroid{
class GraphDevice{
private:
@ -27,12 +26,12 @@ private:
HANDLE mBannerSurface;
class Canvas*mPrimaryContext;
Canvas *mBannerContext;
RefPtr<Region>mInvalidateRgn;
Cairo::RefPtr<Cairo::Region>mInvalidateRgn;
static GraphDevice*mInst;
GraphDevice(int format=-1);
void trackFPS();
void doCompose();
void computeVisibleRegion(std::vector<class Window*>&windows,std::vector<RefPtr<Region>>&regions);
void computeVisibleRegion(std::vector<class Window*>&windows,std::vector<Cairo::RefPtr<Cairo::Region>>&regions);
public:
static GraphDevice&getInstance();
~GraphDevice();

View File

@ -3,7 +3,7 @@
#include <textutils.h>
#include <cdtypes.h>
#include <cdlog.h>
#include <gui/gui_features.h>
#include <gui_features.h>
#ifndef ENABLE_PINYIN2HZ
#include <pinyinime.h>
#endif

View File

@ -5,7 +5,7 @@
#include <fribidi.h>
#include <cdlog.h>
#include <textutils.h>
using namespace Cairo;
namespace cdroid{
#define START 0
#define TOP 1

View File

@ -23,7 +23,7 @@ private:
int mLayout; //mLayout>0 need relayout
Rect mCaretRect;
void pushLineData(int start,int ytop,int descent,int width);
float measureSize(const std::wstring&text,TextExtents&te,FontExtents*fe=nullptr)const;
float measureSize(const std::wstring&text,Cairo::TextExtents&te,Cairo::FontExtents*fe=nullptr)const;
void calculateEllipsis(int line,int linewidth);
void setEllipse(int line,int start,int count);
const std::wstring getLineText(int line,bool expandSllipsis=false)const;

View File

@ -22,7 +22,7 @@
#include <graphdevice.h>
#include <uieventsource.h>
using namespace Cairo;
namespace cdroid {
// Initialize the instance of the singleton to nullptr
WindowManager* WindowManager::mInst = nullptr;

View File

@ -13,7 +13,7 @@ private:
int mCurrentFrame;
int mFrameCount;
void*mHandler;
RefPtr<ImageSurface>mImage;
Cairo::RefPtr<Cairo::ImageSurface>mImage;
State();
~State();
};

View File

@ -4,7 +4,7 @@
#include <cdlog.h>
#include <fstream>
using namespace Cairo;
namespace cdroid{
AnimatedRotateDrawable::AnimatedRotateState::AnimatedRotateState(){

View File

@ -3,6 +3,7 @@
#include <app.h>
#include <cdlog.h>
using namespace Cairo;
namespace cdroid{
BitmapDrawable::BitmapState::BitmapState(){

View File

@ -3,7 +3,6 @@
#include <drawables/drawable.h>
#include <cairomm/surface.h>
#include <cairomm/refptr.h>
using namespace Cairo;
namespace cdroid{
enum TileMode{
@ -29,9 +28,9 @@ private:
int mTileModeY;
int mSrcDensityOverride;
int mTargetDensity;
RefPtr<ImageSurface>mBitmap;
Cairo::RefPtr<Cairo::ImageSurface>mBitmap;
BitmapState();
BitmapState(RefPtr<ImageSurface>bitmap);
BitmapState(Cairo::RefPtr<Cairo::ImageSurface>bitmap);
BitmapState(const BitmapState&bitmapState);
~BitmapState()override;
Drawable* newDrawable()override;
@ -52,12 +51,12 @@ protected:
bool mDstRectAndInsetsDirty;
void onBoundsChange(const Rect&r)override;
bool onStateChange(const std::vector<int>&)override;
static int computeTransparency(RefPtr<ImageSurface>bmp);
static int computeTransparency(Cairo::RefPtr<Cairo::ImageSurface>bmp);
public:
BitmapDrawable(RefPtr<ImageSurface>img);
BitmapDrawable(Cairo::RefPtr<Cairo::ImageSurface>img);
BitmapDrawable(Context*ctx,const std::string&resname);
RefPtr<ImageSurface> getBitmap()const;
void setBitmap(RefPtr<ImageSurface>bmp);
Cairo::RefPtr<Cairo::ImageSurface> getBitmap()const;
void setBitmap(Cairo::RefPtr<Cairo::ImageSurface>bmp);
void setAlpha(int a)override;
int getAlpha()const override;
int getGravity()const;

View File

@ -2,6 +2,7 @@
#include <color.h>
#include <math.h>
#include <algorithm>
using namespace Cairo;
namespace cdroid{
ColorVector::ColorVector(){

View File

@ -3,7 +3,6 @@
#include <vector>
#include <cairomm/refptr.h>
#include <cairomm/surface.h>
using namespace Cairo;
namespace cdroid{
class ColorVector{
@ -35,7 +34,7 @@ public:
void setRGB2YUV();
void setYUV2RGB();
unsigned int transform(unsigned int color);
RefPtr<ImageSurface>transform(const RefPtr<ImageSurface>&img);
Cairo::RefPtr<Cairo::ImageSurface>transform(const Cairo::RefPtr<Cairo::ImageSurface>&img);
};
ColorVector operator * (const ColorMatrix &m , const ColorVector &v);

View File

@ -6,6 +6,7 @@
#include <string.h>
#include <textutils.h>
using namespace Cairo;
namespace cdroid{
Drawable::ConstantState::~ConstantState(){

View File

@ -1,6 +1,7 @@
#include <drawables/gradientdrawable.h>
#include <color.h>
#include <cdlog.h>
using namespace Cairo;
namespace cdroid{
#define DEFAULT_INNER_RADIUS_RATIO 3.0f

View File

@ -116,8 +116,8 @@ private:
std::shared_ptr<GradientState>mGradientState;
std::vector<double>mDashArray;
double mStrokeWidth;
RefPtr<Cairo::Pattern>mStrokePaint;
RefPtr<Cairo::Pattern>mFillPaint;
Cairo::RefPtr<Cairo::Pattern>mStrokePaint;
Cairo::RefPtr<Cairo::Pattern>mFillPaint;
bool ensureValidRect();
void buildPathIfDirty();
bool isOpaqueForState()const;

View File

@ -1,7 +1,7 @@
#include <drawables/ninepatchdrawable.h>
#include <fstream>
#include <cdlog.h>
using namespace Cairo;
namespace cdroid{
//https://github.com/soramimi/QtNinePatch/blob/master/NinePatch.cpp

View File

@ -24,10 +24,10 @@ private:
std::vector<DIV> mHorz;
std::vector<DIV> mVert;
ColorStateList*mTint;
RefPtr<ImageSurface>mNinePatch;
Cairo::RefPtr<Cairo::ImageSurface>mNinePatch;
NinePatchState();
NinePatchState(const NinePatchState&state);
NinePatchState(RefPtr<ImageSurface>bitmap,const Rect*padding=nullptr);
NinePatchState(Cairo::RefPtr<Cairo::ImageSurface>bitmap,const Rect*padding=nullptr);
Drawable*newDrawable()override;
void draw(Canvas&canvas,const Rect&rect);
int getChangingConfigurations()const override;
@ -48,7 +48,7 @@ protected:
bool onStateChange(const std::vector<int>& stateSet)override;
public:
NinePatchDrawable(Context*,const std::string&resid);
NinePatchDrawable(RefPtr<ImageSurface>bmp);
NinePatchDrawable(Cairo::RefPtr<Cairo::ImageSurface>bmp);
~NinePatchDrawable();
void setTargetDensity(int density);
Insets getOpticalInsets()override;

View File

@ -3,7 +3,7 @@
namespace cdroid{
typedef RefPtr<RecordingSurface>Picture;
typedef Cairo::RefPtr<Cairo::RecordingSurface>Picture;
class PictureDrawable:public Drawable{
private:

View File

@ -1,7 +1,7 @@
#include <drawables/rotatedrawable.h>
#include <cdlog.h>
using namespace Cairo;
namespace cdroid{
#define MAX_LEVEL 10000
RotateDrawable::RotateState::RotateState()

View File

@ -1,7 +1,7 @@
#include <drawables/shape.h>
#include <color.h>
#include <cdlog.h>
using namespace Cairo;
namespace cdroid{
Shape::Shape(){

View File

@ -18,7 +18,7 @@ protected:
float mGradientCenterY;
bool bUseLevel;
std::vector<uint32_t>mGradientColors;//size 0:nofill, 1:solid fill 2,3:gradient fill
RefPtr<Pattern>mPaint;//used to fill
Cairo::RefPtr<Cairo::Pattern>mPaint;//used to fill
void rebuildPattern(int x,int y);
virtual void onResize(int width,int height){}
void fill_stroke(Canvas&canvas,int x,int y);
@ -57,7 +57,7 @@ protected:
std::vector<float>mInnerRadii;
Rect mInset;
Rect mInnerRect;
RefPtr<cdroid::Path>mPath;
Cairo::RefPtr<cdroid::Path>mPath;
protected:
RectShape(const RectShape&o);
void onResize(int width,int height)override;

View File

@ -1,4 +1,6 @@
#include <view/menu.h>
using namespace Cairo;
namespace cdroid{
MenuItem::MenuItem(){

View File

@ -48,7 +48,7 @@ protected:
bool mChecked;
bool mVisible;
bool mEnabled;
RefPtr<ImageSurface>mIcon;
Cairo::RefPtr<Cairo::ImageSurface>mIcon;
SubMenu*mSubMenu;
friend class Menu;
public:

View File

@ -1,4 +1,5 @@
#include <view/rendernode.h>
using namespace Cairo;
namespace cdroid{
RenderNode::RenderNode(){

View File

@ -12,12 +12,12 @@ private:
float mRotationX,mRotationY,mRotation;
float mPivotX,mPivotY;
float mTranslationX,mTranslationY,mTranslationZ;
Matrix mMatrix;
Cairo::Matrix mMatrix;
public:
RenderNode();
bool hasIdentityMatrix()const;
Matrix getMatrix()const;
Matrix getInverseMatrix()const;
Cairo::Matrix getMatrix()const;
Cairo::Matrix getInverseMatrix()const;
void setAlpha(float);
float getAlpha()const;
void setElevation(float);

View File

@ -14,7 +14,7 @@
#include <systemclock.h>
#define UNDEFINED_PADDING INT_MIN
using namespace Cairo;
namespace cdroid{
DECLARE_WIDGET(View)

View File

@ -189,7 +189,7 @@ protected:
bool mKeepScreenOn;
bool mDebugLayout;
bool mDisplayState;/*true display is on*/
RefPtr<Canvas> mCanvas;
Cairo::RefPtr<Canvas> mCanvas;
Drawable*mAutofilledDrawable;
View* mTooltipHost;
View* mViewRequestingLayout;
@ -484,8 +484,8 @@ protected:
bool mLastIsOpaque;
std::string mHint;
std::string mContentDescription;
RefPtr<ImageSurface> mDrawingCache;
RefPtr<ImageSurface> mUnscaledDrawingCache;
Cairo::RefPtr<Cairo::ImageSurface> mDrawingCache;
Cairo::RefPtr<Cairo::ImageSurface> mUnscaledDrawingCache;
void * mTag;
Context* mContext;
LayoutParams* mLayoutParams;
@ -524,7 +524,7 @@ protected:
void invalidateParentIfNeededAndWasQuickRejected();
virtual void invalidateInheritedLayoutMode(int);
void destroyDrawingCache();
RefPtr<ImageSurface>getDrawingCache(bool autoScale);
Cairo::RefPtr<Cairo::ImageSurface>getDrawingCache(bool autoScale);
virtual bool hasWindowFocus()const;
virtual bool setFrame(int x,int y,int w,int h);

View File

@ -26,6 +26,7 @@
#define CHILD_LEFT_INDEX 0
#define CHILD_TOP_INDEX 1
using namespace Cairo;
namespace cdroid {
DECLARE_WIDGET(ViewGroup)

View File

@ -158,7 +158,7 @@ protected:
int mPersistentDrawingCache;
std::vector<View*> mChildren;
std::vector<View*>mDisappearingChildren;
RefPtr<Region>mInvalidRgn;
Cairo::RefPtr<Cairo::Region>mInvalidRgn;
Transformation*mInvalidationTransformation;
LONGLONG time_lastframe;
OnHierarchyChangeListener mOnHierarchyChangeListener;

View File

@ -1,5 +1,6 @@
#include <view/view.h>
#include <view/viewpropertyanimator.h>
#include "cdlog.h"
namespace cdroid{

View File

@ -67,7 +67,6 @@ private:
//If no custom field is assigned, assume the whole resource is a TextView
//Otherwise, find the TextView field within the layout
TextView* text = (mFieldId==0)?(TextView*)view:(TextView*)view->findViewById(mFieldId);
LOGD_IF(text==nullptr,"Failed to find view with ID %d in item layout",mFieldId);
T& item = getItemAt(position);
if(text&&onSetText)onSetText(*text,item);
return view;

View File

@ -24,6 +24,7 @@
#include <view/swipehelper.h>
#include <fstream>
using namespace Cairo;
namespace cdroid {
constexpr int FORWARD = 0;
constexpr int FINISH_HANDLED = 1;

View File

@ -49,7 +49,7 @@ private:
static View*inflate(Context*ctx,std::istream&stream);
protected:
std::vector<View*>mLayoutRequesters;
RefPtr<Region>mVisibleRgn;
Cairo::RefPtr<Cairo::Region>mVisibleRgn;
int window_type;/*window type*/
int mLayer;/*surface layer*/
std::string mText;
@ -66,7 +66,7 @@ protected:
int processInputEvent(InputEvent&event);
int processKeyEvent(KeyEvent&event);
int processPointerEvent(MotionEvent&event);
RefPtr<Canvas>getCanvas();
Cairo::RefPtr<Canvas>getCanvas();
ViewGroup::LayoutParams* generateDefaultLayoutParams()const override;
bool checkLayoutParams(const ViewGroup::LayoutParams* p)const override;
ViewGroup::LayoutParams* generateLayoutParams(const ViewGroup::LayoutParams* lp)const override;
@ -84,7 +84,7 @@ public:
Window(int x,int y,int w,int h,int type=TYPE_APPLICATION);
Window(Context*,const AttributeSet&);
~Window()override;
void setRegion(const RefPtr<Region>&region);
void setRegion(const Cairo::RefPtr<Cairo::Region>&region);
void draw();
virtual void setText(const std::string&);
const std::string getText()const;

View File

@ -3,6 +3,7 @@
#include <widget/headerviewlistadapter.h>
#include <core/mathutils.h>
#include <float.h>
#include <cdlog.h>
namespace cdroid{

View File

@ -1,5 +1,6 @@
#include <widget/forwardinglistener.h>
#include <widget/dropdownlistview.h>
#include <cdlog.h>
namespace cdroid{
ForwardingListener::ForwardingListener(View* src){

View File

@ -1,6 +1,7 @@
#include <widget/imageview.h>
#include <app.h>
#include <cdlog.h>
using namespace Cairo;
namespace cdroid{
DECLARE_WIDGET(ImageView)

View File

@ -82,7 +82,7 @@ public:
void setAdjustViewBounds(bool adjustViewBounds);
void setImageResource(const std::string&resid);
void setImageDrawable(Drawable* drawable);
void setImageBitmap(RefPtr<ImageSurface>bitmap);
void setImageBitmap(Cairo::RefPtr<Cairo::ImageSurface>bitmap);
void setImageTintList(ColorStateList*tint);
ColorStateList* getImageTintList();
void setImageTintMode(int mode);

View File

@ -1,5 +1,6 @@
#include <widget/listpopupwindow.h>
#include <widget/linearlayout.h>
#include <cdlog.h>
namespace cdroid{
class PopupDataSetObserver:public DataSetObserver{

View File

@ -1,4 +1,5 @@
#include <widget/pagetransformers.h>
#include <cdlog.h>
namespace cdroid{
void ABaseTransformer::transformPage(View& page, float position) {

View File

@ -1,5 +1,5 @@
#include <widget/plotview.h>
#include <gui/gui_features.h>
#include <gui_features.h>
#ifdef ENABLE_PLPLOT
#include <plstream.h>
#endif

View File

@ -6,8 +6,8 @@ namespace cdroid{
class PlotView:public View{
private:
RefPtr<ImageSurface>mImage;
RefPtr<Cairo::Context>mImageContext;
Cairo::RefPtr<Cairo::ImageSurface>mImage;
Cairo::RefPtr<Cairo::Context>mImageContext;
plstream*pls;
public:
PlotView(int w,int h);

View File

@ -1,4 +1,5 @@
#include <widget/popupwindow.h>
#include <cdlog.h>
namespace cdroid{
PopupWindow::PopupWindow(Context* context,const AttributeSet& attrs){

View File

@ -1,5 +1,6 @@
#include <widget/relativelayout.h>
#include <string.h>
#include <cdlog.h>
namespace cdroid{
static constexpr int RULES_VERTICAL[] = {

View File

@ -1,5 +1,6 @@
#include <widget/tablayout.h>
#include <widget/R.h>
#include <cdlog.h>
namespace cdroid{
static constexpr int DEFAULT_HEIGHT_WITH_TEXT_ICON = 72;

View File

@ -63,6 +63,7 @@ endif()
list(APPEND X86LIBS pthread)
find_package(ZLIB)
message("ZLIB_INCLUDE=${ZLIB_INCLUDE_DIR}")
include_directories(./
../include
${CMAKE_SOURCE_DIR}/src/gui/

View File

@ -1,3 +1,5 @@
add_definitions(--include cdtypes.h)
add_definitions(--include cdlog.h)
if (BUILD_CDROID_TESTS)
add_subdirectory(gui)
add_subdirectory(porting)

View File

@ -4,7 +4,7 @@
#include <ngl_os.h>
using namespace cdroid;
using namespace Cairo;
class BENCHMARK:public testing::Test{
public :

View File

@ -7,6 +7,7 @@
#include <core/systemclock.h>
#include <core/path.h>
#define SLEEP(x) usleep((x)*1000)
using namespace Cairo;
class DRAWABLE:public testing::Test{
public:
static Canvas*ctx;

View File

@ -9,6 +9,7 @@
#include <sstream>
#include <core/systemclock.h>
using namespace Cairo;
class MUTATE:public testing::Test{
public:
static void SetUpTestCase(){

View File

@ -13,7 +13,7 @@
#include <cdlog.h>
#include <core/textutils.h>
#include <fribidi.h>
using namespace Cairo;
using namespace cdroid;
#define SLEEP(x) usleep((x)*1000)
class CONTEXT:public testing::Test{

View File

@ -12,6 +12,7 @@ fi
cmake -DCDROID_CHIPSET=x86 -DENABLE_RFB=ON \
-DCMAKE_INSTALL_PREFIX=./ \
-DCMAKE_BUILD_TYPE=${TYPE} \
-DM_LIBRARY=m \
..
popd