diff --git a/samplecode/SampleFontScalerTest.cpp b/samplecode/SampleFontScalerTest.cpp index 44c207c718..d597a9adfb 100644 --- a/samplecode/SampleFontScalerTest.cpp +++ b/samplecode/SampleFontScalerTest.cpp @@ -29,14 +29,6 @@ static const struct { static const int gFaceCount = SK_ARRAY_COUNT(gFaces); -static const char* gStrings[] = { - "HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH", - "iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii", - "......................................", - "11111111111111111111111111111111111111", - "00000000000000000000000000000000000000" -}; - class FontScalerTestView : public SkView { SkTypeface* fFaces[gFaceCount]; @@ -110,7 +102,6 @@ protected: int index = 0; for (int ps = 9; ps <= 24; ps++) { - // text = gStrings[index % SK_ARRAY_COUNT(gStrings)]; textLen = strlen(text); paint.setTextSize(SkIntToScalar(ps)); canvas->drawText(text, textLen, x, y, paint); diff --git a/samplecode/SampleImageDir.cpp b/samplecode/SampleImageDir.cpp index 922910ce32..e221fe187a 100644 --- a/samplecode/SampleImageDir.cpp +++ b/samplecode/SampleImageDir.cpp @@ -234,21 +234,12 @@ protected: DrawRoundRect(*canvas); return; } - - SkScalar scale = SK_Scalar1 * 999/1000; -// scale = SK_Scalar1/2; - + canvas->translate(SkIntToScalar(10), SkIntToScalar(10)); - // canvas->scale(scale, scale); SkScalar x = SkIntToScalar(32), y = SkIntToScalar(32); SkPaint paint; - - // x += fDX; - // y += fDY; - -// paint.setLooper(new SkBlurDrawLooper(SkIntToScalar(12), 0, 0, 0xDD000000))->unref(); - + #if 0 for (int i = 0; i < fBitmapCount; i++) { SkPaint p; diff --git a/samplecode/SamplePageFlip.cpp b/samplecode/SamplePageFlip.cpp index 6b1adfd903..ed4d340998 100644 --- a/samplecode/SamplePageFlip.cpp +++ b/samplecode/SamplePageFlip.cpp @@ -44,7 +44,7 @@ static void* draw_proc(void* context) { SkPaint paint; paint.setAntiAlias(true); - paint.setColor(reinterpret_cast(ref) | (0xFF << 24)); + paint.setColor(SK_ColorRED); SkRect oval; oval.setEmpty(); diff --git a/samplecode/SampleShaders.cpp b/samplecode/SampleShaders.cpp index f5ddca9a76..19f4930389 100644 --- a/samplecode/SampleShaders.cpp +++ b/samplecode/SampleShaders.cpp @@ -48,7 +48,7 @@ public: ShaderView() { - SkImageDecoder::DecodeFile("/cover.png", &fBitmap); + SkImageDecoder::DecodeFile("/skimages/logo.gif", &fBitmap); SkPoint pts[2]; SkColor colors[2]; @@ -79,14 +79,12 @@ public: protected: // overrides from SkEventSink - virtual bool onQuery(SkEvent* evt) - { - if (SampleCode::TitleQ(*evt)) - { - SampleCode::TitleR(evt, "Shaders"); - return true; - } - return this->INHERITED::onQuery(evt); + virtual bool onQuery(SkEvent* evt) { + if (SampleCode::TitleQ(*evt)) { + SampleCode::TitleR(evt, "Shaders"); + return true; + } + return this->INHERITED::onQuery(evt); } void drawBG(SkCanvas* canvas) @@ -101,18 +99,7 @@ protected: canvas->drawBitmap(fBitmap, 0, 0); - { - SkIRect src; - SkRect dst; - - src.set(20, 50, 120, 70); - dst.set(src); - dst.offset(SkIntToScalar(300), 0); - - canvas->drawBitmapRect(fBitmap, &src, dst); - } - - canvas->translate(SkIntToScalar(80), SkIntToScalar(80)); + canvas->translate(SkIntToScalar(20), SkIntToScalar(120)); SkPaint paint; SkRect r; @@ -124,7 +111,11 @@ protected: canvas->translate(SkIntToScalar(110), 0); - r.set(0, 0, SkIntToScalar(fBitmap.width()), SkIntToScalar(fBitmap.height())); + int w = fBitmap.width(); + int h = fBitmap.height(); + w = 120; + h = 80; + r.set(0, 0, SkIntToScalar(w), SkIntToScalar(h)); paint.setShader(NULL); canvas->drawRect(r, paint); diff --git a/samplecode/SampleText.cpp b/samplecode/SampleText.cpp index 83ff68d7ee..7b8bcf0314 100644 --- a/samplecode/SampleText.cpp +++ b/samplecode/SampleText.cpp @@ -90,13 +90,13 @@ static SkMaskFilter* makemf() { return new Darken(0x30); } static void test_typefaceCache() { +#ifdef ANDROID SkTypeface* t0 = SkTypeface::CreateFromName("sans-serif", SkTypeface::kNormal); SkTypeface* t1 = SkTypeface::CreateFromName(NULL, SkTypeface::kNormal); SkTypeface* t2 = SkTypeface::CreateFromName("arial", SkTypeface::kNormal); SkTypeface* t3 = SkTypeface::CreateFromName("helvetica", SkTypeface::kItalic); -#ifdef ANDROID SkASSERT(t0 == t1); SkASSERT(t0 == t2); SkASSERT(t0 == t3); diff --git a/samplecode/SampleVertices.cpp b/samplecode/SampleVertices.cpp index fcd962867a..84f1e1254f 100644 --- a/samplecode/SampleVertices.cpp +++ b/samplecode/SampleVertices.cpp @@ -20,48 +20,6 @@ #include "SkStream.h" #include "SkNinePatch.h" -void setup_vertexbug(SkPoint verts[], SkPoint texs[], uint16_t index[]); - -static void drawbug(SkCanvas* canvas, SkScalar scale) { - SkBitmap bm, bm2; - - SkImageDecoder::DecodeFile("/skimages/btn_default_normal.9.png", &bm); - SkPaint paint; - - SkIRect subset; - subset.set(1, 1, bm.width() - 1, bm.height() - 1); - bm.extractSubset(&bm2, subset); - -#if 0 - SkPoint verts[16], texs[16]; - uint16_t index[54]; - - SkShader* s = SkShader::CreateBitmapShader(bm2, SkShader::kClamp_TileMode, - SkShader::kClamp_TileMode); - paint.setShader(s)->unref(); - - setup_vertexbug(verts, texs, index); - int indexCount = 6; // 54 - canvas->drawVertices(SkCanvas::kTriangles_VertexMode, 16, verts, texs, - NULL, NULL, &index[6], indexCount, paint); - -#if 0 - paint.setShader(NULL); - canvas->drawVertices(SkCanvas::kTriangles_VertexMode, 16, verts, NULL, - NULL, NULL, index, indexCount, paint); -#endif -#else - SkRect dst; - SkIRect margin; - - dst.set(SkIntToScalar(10), SkIntToScalar(10), - SkIntToScalar(100) + scale, - SkIntToScalar(40) + scale); - margin.set(9, 9, 9, 9); - SkNinePatch::DrawNine(canvas, dst, bm2, margin, NULL); -#endif -} - static SkShader* make_shader0(SkIPoint* size) { SkBitmap bm; @@ -122,16 +80,6 @@ protected: virtual void onDraw(SkCanvas* canvas) { this->drawBG(canvas); -#if 1 - canvas->drawColor(SK_ColorWHITE); - canvas->translate(SK_Scalar1/2, SkIntToScalar(15) + SK_Scalar1/2); - canvas->scale(SkIntToScalar(3)/2, SkIntToScalar(3)/2); - drawbug(canvas, fScale); - fScale += SK_Scalar1/93; - this->inval(NULL); - return; -#endif - SkPaint paint; paint.setDither(true); paint.setFilterBitmap(true); diff --git a/src/images/SkFlipPixelRef.cpp b/src/images/SkFlipPixelRef.cpp index 95403cc3f9..8d0f15a703 100644 --- a/src/images/SkFlipPixelRef.cpp +++ b/src/images/SkFlipPixelRef.cpp @@ -49,6 +49,7 @@ void SkFlipPixelRef::onUnlockPixels() { void SkFlipPixelRef::swapPages() { fMutex.acquire(); SkTSwap(fPage0, fPage1); + this->notifyPixelsChanged(); fMutex.release(); } diff --git a/xcode/sampleapp_sdl/SDLApp.xcodeproj/project.pbxproj b/xcode/sampleapp_sdl/SDLApp.xcodeproj/project.pbxproj index 75a0285121..4779784377 100644 --- a/xcode/sampleapp_sdl/SDLApp.xcodeproj/project.pbxproj +++ b/xcode/sampleapp_sdl/SDLApp.xcodeproj/project.pbxproj @@ -37,14 +37,12 @@ 0064EE3F0FC72BEE00D71FB0 /* SampleMeasure.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE0B0FC72BEE00D71FB0 /* SampleMeasure.cpp */; }; 0064EE410FC72BEE00D71FB0 /* SampleNinePatch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE0D0FC72BEE00D71FB0 /* SampleNinePatch.cpp */; }; 0064EE420FC72BEE00D71FB0 /* SampleOverflow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE0E0FC72BEE00D71FB0 /* SampleOverflow.cpp */; }; - 0064EE440FC72BEE00D71FB0 /* SamplePatch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE100FC72BEE00D71FB0 /* SamplePatch.cpp */; }; 0064EE450FC72BEE00D71FB0 /* SamplePath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE110FC72BEE00D71FB0 /* SamplePath.cpp */; }; 0064EE460FC72BEE00D71FB0 /* SamplePathClip.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE120FC72BEE00D71FB0 /* SamplePathClip.cpp */; }; 0064EE470FC72BEE00D71FB0 /* SamplePathEffects.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE130FC72BEE00D71FB0 /* SamplePathEffects.cpp */; }; 0064EE480FC72BEE00D71FB0 /* SamplePicture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE140FC72BEE00D71FB0 /* SamplePicture.cpp */; }; 0064EE490FC72BEE00D71FB0 /* SamplePoints.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE150FC72BEE00D71FB0 /* SamplePoints.cpp */; }; 0064EE4B0FC72BEE00D71FB0 /* SampleRegion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE170FC72BEE00D71FB0 /* SampleRegion.cpp */; }; - 0064EE4C0FC72BEE00D71FB0 /* SampleShaders.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE180FC72BEE00D71FB0 /* SampleShaders.cpp */; }; 0064EE4E0FC72BEE00D71FB0 /* SampleStrokeText.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE1A0FC72BEE00D71FB0 /* SampleStrokeText.cpp */; }; 0064EE500FC72BEE00D71FB0 /* SampleText.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE1C0FC72BEE00D71FB0 /* SampleText.cpp */; }; 0064EE510FC72BEE00D71FB0 /* SampleTextAlpha.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE1D0FC72BEE00D71FB0 /* SampleTextAlpha.cpp */; }; @@ -52,7 +50,6 @@ 0064EE530FC72BEE00D71FB0 /* SampleTextOnPath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE1F0FC72BEE00D71FB0 /* SampleTextOnPath.cpp */; }; 0064EE540FC72BEE00D71FB0 /* SampleTiling.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE200FC72BEE00D71FB0 /* SampleTiling.cpp */; }; 0064EE550FC72BEE00D71FB0 /* SampleTypeface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE210FC72BEE00D71FB0 /* SampleTypeface.cpp */; }; - 0064EE560FC72BEE00D71FB0 /* SampleVertices.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE220FC72BEE00D71FB0 /* SampleVertices.cpp */; }; 0064EE570FC72BEE00D71FB0 /* SampleXfermodes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE230FC72BEE00D71FB0 /* SampleXfermodes.cpp */; }; 0064EE580FC72BEE00D71FB0 /* vertexdump.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE240FC72BEE00D71FB0 /* vertexdump.cpp */; }; 0064EE960FC7318500D71FB0 /* SkImageRefPool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE930FC7318500D71FB0 /* SkImageRefPool.cpp */; }; @@ -77,7 +74,6 @@ 006DC7EB0FC7475E00BF5F45 /* libmaccore.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 006DC7E10FC7475700BF5F45 /* libmaccore.a */; }; 006DC7EC0FC7475F00BF5F45 /* libcore.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 006DC7E90FC7475900BF5F45 /* libcore.a */; }; 2762F6040FCCC832002BD8B4 /* SampleShapes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE190FC72BEE00D71FB0 /* SampleShapes.cpp */; }; - 2762F6350FCCCA00002BD8B4 /* SamplePageFlip.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE0F0FC72BEE00D71FB0 /* SamplePageFlip.cpp */; }; 2762F6420FCCCA6C002BD8B4 /* SkFlipPixelRef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2762F6400FCCCA6C002BD8B4 /* SkFlipPixelRef.cpp */; }; 2762F6430FCCCA6C002BD8B4 /* SkPageFlipper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2762F6410FCCCA6C002BD8B4 /* SkPageFlipper.cpp */; }; 2762F6C20FCCCBC0002BD8B4 /* SampleAll.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EDF00FC72BEE00D71FB0 /* SampleAll.cpp */; }; @@ -88,6 +84,10 @@ 277836410FCF8908006549E4 /* SkGLTextCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2778363B0FCF8908006549E4 /* SkGLTextCache.cpp */; }; 277836420FCF8908006549E4 /* SkTextureCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2778363C0FCF8908006549E4 /* SkTextureCache.cpp */; }; 277836500FCF89F9006549E4 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2778364F0FCF89F9006549E4 /* OpenGL.framework */; }; + 27E1AAA70FD0C51B00098FC5 /* SampleVertices.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE220FC72BEE00D71FB0 /* SampleVertices.cpp */; }; + 27E1AACB0FD0C87200098FC5 /* SamplePatch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE100FC72BEE00D71FB0 /* SamplePatch.cpp */; }; + 27E1AAE00FD0C9B500098FC5 /* SampleShaders.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE180FC72BEE00D71FB0 /* SampleShaders.cpp */; }; + 27E1AB2B0FD0D06600098FC5 /* SamplePageFlip.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE0F0FC72BEE00D71FB0 /* SamplePageFlip.cpp */; }; 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; /* End PBXBuildFile section */ @@ -579,13 +579,11 @@ 0064EE3F0FC72BEE00D71FB0 /* SampleMeasure.cpp in Sources */, 0064EE410FC72BEE00D71FB0 /* SampleNinePatch.cpp in Sources */, 0064EE420FC72BEE00D71FB0 /* SampleOverflow.cpp in Sources */, - 0064EE440FC72BEE00D71FB0 /* SamplePatch.cpp in Sources */, 0064EE450FC72BEE00D71FB0 /* SamplePath.cpp in Sources */, 0064EE460FC72BEE00D71FB0 /* SamplePathClip.cpp in Sources */, 0064EE470FC72BEE00D71FB0 /* SamplePathEffects.cpp in Sources */, 0064EE490FC72BEE00D71FB0 /* SamplePoints.cpp in Sources */, 0064EE4B0FC72BEE00D71FB0 /* SampleRegion.cpp in Sources */, - 0064EE4C0FC72BEE00D71FB0 /* SampleShaders.cpp in Sources */, 0064EE4E0FC72BEE00D71FB0 /* SampleStrokeText.cpp in Sources */, 0064EE500FC72BEE00D71FB0 /* SampleText.cpp in Sources */, 0064EE510FC72BEE00D71FB0 /* SampleTextAlpha.cpp in Sources */, @@ -593,7 +591,6 @@ 0064EE530FC72BEE00D71FB0 /* SampleTextOnPath.cpp in Sources */, 0064EE540FC72BEE00D71FB0 /* SampleTiling.cpp in Sources */, 0064EE550FC72BEE00D71FB0 /* SampleTypeface.cpp in Sources */, - 0064EE560FC72BEE00D71FB0 /* SampleVertices.cpp in Sources */, 0064EE480FC72BEE00D71FB0 /* SamplePicture.cpp in Sources */, 0064EE570FC72BEE00D71FB0 /* SampleXfermodes.cpp in Sources */, 0064EE580FC72BEE00D71FB0 /* vertexdump.cpp in Sources */, @@ -616,7 +613,6 @@ 0064EED20FC7336100D71FB0 /* SkWindow.cpp in Sources */, 0064EFA60FC7467C00D71FB0 /* skia_sdl_main.cpp in Sources */, 2762F6040FCCC832002BD8B4 /* SampleShapes.cpp in Sources */, - 2762F6350FCCCA00002BD8B4 /* SamplePageFlip.cpp in Sources */, 2762F6420FCCCA6C002BD8B4 /* SkFlipPixelRef.cpp in Sources */, 2762F6430FCCCA6C002BD8B4 /* SkPageFlipper.cpp in Sources */, 2762F6C20FCCCBC0002BD8B4 /* SampleAll.cpp in Sources */, @@ -626,6 +622,10 @@ 277836400FCF8908006549E4 /* SkGLDevice_FBO.cpp in Sources */, 277836410FCF8908006549E4 /* SkGLTextCache.cpp in Sources */, 277836420FCF8908006549E4 /* SkTextureCache.cpp in Sources */, + 27E1AAA70FD0C51B00098FC5 /* SampleVertices.cpp in Sources */, + 27E1AACB0FD0C87200098FC5 /* SamplePatch.cpp in Sources */, + 27E1AAE00FD0C9B500098FC5 /* SampleShaders.cpp in Sources */, + 27E1AB2B0FD0D06600098FC5 /* SamplePageFlip.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/xcode/sampleapp_sdl/skia_sdl_main.cpp b/xcode/sampleapp_sdl/skia_sdl_main.cpp index ef16049992..25abec23b9 100644 --- a/xcode/sampleapp_sdl/skia_sdl_main.cpp +++ b/xcode/sampleapp_sdl/skia_sdl_main.cpp @@ -17,7 +17,7 @@ #define WINDOW_WIDTH 800 #define WINDOW_HEIGHT 600 -#define USE_GL true +#define USE_GL false int main(int argc, char *argv[]) { Uint32 initflags = SDL_INIT_VIDEO | SDL_INIT_TIMER;