diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-02-13 15:29:03 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-02-13 15:29:03 +0000 |
commit | bda591c739001b41d77048d680f81e05723cbc05 (patch) | |
tree | 80f0326a191c966bc34057e4011bdb3233bc2a50 | |
parent | b2d93a91222dac2edb3c19128fd58fa2e74272aa (diff) |
Revert of add peekPixels to SkCanvas and SkSurface (https://codereview.chromium.org/161733002/)
Reason for revert:
compile issues with gm/xfermodes3
Original issue's description:
> add peekPixels to SkCanvas and SkSurface
>
> clone of https://codereview.chromium.org/159723006/
>
> Committed: https://code.google.com/p/skia/source/detail?r=13427
R=jvanverth@google.com
NOTREECHECKS=true
NOTRY=true
Author: reed@chromium.org
Review URL: https://codereview.chromium.org/163823002
git-svn-id: http://skia.googlecode.com/svn/trunk@13428 2bbb7eff-a529-9590-31e7-b0007b416f81
35 files changed, 303 insertions, 402 deletions
diff --git a/gm/aaclip.cpp b/gm/aaclip.cpp index 5742902f09..ec29a4f896 100644 --- a/gm/aaclip.cpp +++ b/gm/aaclip.cpp @@ -9,11 +9,203 @@ #include "SkCanvas.h" #include "SkPath.h" +static void test_quadstroke(SkCanvas* canvas) { + SkPath path; + path.moveTo(6, 0); + path.quadTo(150, 150, 0, 6); + + SkPaint paint; + + paint.setAntiAlias(true); + paint.setStyle(SkPaint::kStroke_Style); + canvas->translate(20, 20); + +#if 1 + canvas->drawPath(path, paint); + canvas->translate(100, 0); +#endif + + paint.setStrokeWidth(1.01f); + canvas->drawPath(path, paint); +} + +static void draw_conic(SkCanvas* canvas, SkScalar weight, const SkPaint& paint) { + SkPath path; + path.moveTo(100, 100); + path.conicTo(300, 100, 300, 300, weight); + canvas->drawPath(path, paint); +} + +static void test_conic(SkCanvas* canvas) { + SkPaint paint; + paint.setAntiAlias(true); + paint.setStyle(SkPaint::kStroke_Style); + + static const struct { + SkScalar fWeight; + SkColor fColor; + } gRec[] = { + { 2 , SK_ColorRED }, + { 1 , SK_ColorGREEN }, + { 0.5f, SK_ColorBLUE }, + }; + + for (SkScalar width = 0; width <= 20; width += 20) { + canvas->save(); + paint.setStrokeWidth(width); + for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); ++i) { + paint.setColor(gRec[i].fColor); + draw_conic(canvas, gRec[i].fWeight, paint); + canvas->translate(-30, 30); + } + canvas->restore(); + canvas->translate(300, 0); + } +} + +#include "SkGradientShader.h" +static void test_shallow_gradient(SkCanvas* canvas, SkScalar width, SkScalar height) { + SkColor colors[] = { 0xFF7F7F7F, 0xFF7F7F7F, 0xFF000000 }; + SkScalar pos[] = { 0, 0.35f, SK_Scalar1 }; + SkPoint pts[] = { { 0, 0 }, { width, height } }; + SkShader* s = SkGradientShader::CreateLinear(pts, colors, pos, + SK_ARRAY_COUNT(colors), + SkShader::kClamp_TileMode); + SkPaint paint; + paint.setShader(s)->unref(); + canvas->drawPaint(paint); +} + +#include "SkDashPathEffect.h" +static void test_giant_dash(SkCanvas* canvas) { + SkPaint paint; + const SkScalar intervals[] = { SK_Scalar1, SK_Scalar1 }; + + paint.setStrokeWidth(2); + paint.setPathEffect(new SkDashPathEffect(intervals, 2, 0))->unref(); + + SkScalar big = 500 * 1000; + + canvas->drawLine(10, 10, big, 10, paint); + canvas->drawLine(-big, 20, 500, 20, paint); + canvas->drawLine(-big, 30, big, 30, paint); + + const SkScalar intervals2[] = { 20, 5, 10, 5 }; + paint.setPathEffect(new SkDashPathEffect(intervals2, 4, 17))->unref(); + + canvas->translate(0, 40); + SkScalar x = -500; + SkScalar width = 3173; + for (int i = 0; i < 40; ++i) { + if (i > 10) + canvas->drawLine(x, 0, x + width, 0, paint); + x += 1; + canvas->translate(0, 4); + } +} + + + +// Reproduces bug found here: http://jsfiddle.net/R8Cu5/1/ +// +#include "SkGradientShader.h" +static void test_grad(SkCanvas* canvas) { + SkPoint pts[] = { + { 478.544067f, -84.2041016f }, + { 602.455933f, 625.204102f }, + }; + SkColor colors[] = { SK_ColorBLACK, SK_ColorBLACK, SK_ColorRED, SK_ColorRED }; + SkScalar pos[] = { 0, 0.3f, 0.3f, 1.0f }; + SkShader* s = SkGradientShader::CreateLinear(pts, colors, pos, 4, SkShader::kClamp_TileMode); + SkPaint p; + p.setShader(s)->unref(); + canvas->drawPaint(p); +} + +static SkCanvas* MakeCanvas(const SkIRect& bounds) { + SkBitmap bm; + bm.allocN32Pixels(bounds.width(), bounds.height()); + bm.eraseColor(SK_ColorTRANSPARENT); + + SkCanvas* canvas = new SkCanvas(bm); + canvas->translate(-SkIntToScalar(bounds.fLeft), -SkIntToScalar(bounds.fTop)); + return canvas; +} + +#ifdef SK_DEBUG +static void GetBitmap(const SkCanvas* canvas, SkBitmap* bm) { + *bm = canvas->getDevice()->accessBitmap(false); +} +#endif + +static void compare_canvas(const SkCanvas* a, const SkCanvas* b) { +#ifdef SK_DEBUG + SkBitmap bma, bmb; + GetBitmap(a, &bma); + GetBitmap(b, &bmb); + + SkASSERT(bma.width() == bmb.width()); + SkASSERT(bma.height() == bmb.height()); + + bma.lockPixels(); + bmb.lockPixels(); + for (int y = 0; y < bma.height(); ++y) { + const SkPMColor* rowa = bma.getAddr32(0, y); + const SkPMColor* rowb = bmb.getAddr32(0, y); + SkASSERT(!memcmp(rowa, rowb, bma.width() << 2)); + + for (int x = 1; x < bma.width() - 1; ++x) { + SkASSERT(0xFF000000 == rowa[x]); + SkASSERT(0xFF000000 == rowb[x]); + } + } +#endif +} + +static void drawRectAsPath(SkCanvas* canvas, const SkRect& r, const SkPaint& p) { + SkPath path; + path.addRect(r); + canvas->drawPath(path, p); +} + +static void test_maskFromPath(const SkPath& path) { + SkIRect bounds; + path.getBounds().roundOut(&bounds); + + SkPaint paint; + paint.setAntiAlias(true); + + SkAutoTUnref<SkCanvas> path_canvas(MakeCanvas(bounds)); + path_canvas->drawPath(path, paint); + + SkAutoTUnref<SkCanvas> rect_canvas(MakeCanvas(bounds)); + drawRectAsPath(rect_canvas, path.getBounds(), paint); + + compare_canvas(path_canvas, rect_canvas); +} + +static void test_mask() { + for (int i = 1; i <= 20; ++i) { + const SkScalar dx = SK_Scalar1 / i; + const SkRect constr = SkRect::MakeWH(dx, SkIntToScalar(2)); + for (int n = 2; n < 20; ++n) { + SkPath path; + path.setFillType(SkPath::kEvenOdd_FillType); + SkRect r = constr; + while (r.fRight < SkIntToScalar(4)) { + path.addRect(r); + r.offset(dx, 0); + } + test_maskFromPath(path); + } + } +} + /** Draw a 2px border around the target, then red behind the target; set the clip to match the target, then draw >> the target in blue. */ -static void draw(SkCanvas* canvas, SkRect& target, int x, int y) { +static void draw (SkCanvas* canvas, SkRect& target, int x, int y) { SkPaint borderPaint; borderPaint.setColor(SkColorSetRGB(0x0, 0xDD, 0x0)); borderPaint.setAntiAlias(true); @@ -36,22 +228,22 @@ static void draw(SkCanvas* canvas, SkRect& target, int x, int y) { canvas->restore(); } -static void draw_square(SkCanvas* canvas, int x, int y) { +static void draw_square (SkCanvas* canvas, int x, int y) { SkRect target (SkRect::MakeWH(10 * SK_Scalar1, 10 * SK_Scalar1)); draw(canvas, target, x, y); } -static void draw_column(SkCanvas* canvas, int x, int y) { +static void draw_column (SkCanvas* canvas, int x, int y) { SkRect target (SkRect::MakeWH(1 * SK_Scalar1, 10 * SK_Scalar1)); draw(canvas, target, x, y); } -static void draw_bar(SkCanvas* canvas, int x, int y) { +static void draw_bar (SkCanvas* canvas, int x, int y) { SkRect target (SkRect::MakeWH(10 * SK_Scalar1, 1 * SK_Scalar1)); draw(canvas, target, x, y); } -static void draw_rect_tests(SkCanvas* canvas) { +static void draw_rect_tests (SkCanvas* canvas) { draw_square(canvas, 10, 10); draw_column(canvas, 30, 10); draw_bar(canvas, 10, 30); @@ -80,6 +272,23 @@ protected: } virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { + if (false) { test_quadstroke(canvas); return; } + if (false) { test_conic(canvas); return; } + if (false) { + SkRect bounds; + canvas->getClipBounds(&bounds); + test_shallow_gradient(canvas, bounds.width(), bounds.height()); return; + } + if (false) { + test_giant_dash(canvas); return; + } + if (false) { + test_grad(canvas); return; + } + if (false) { // avoid bit rot, suppress warning + test_mask(); + } + // Initial pixel-boundary-aligned draw draw_rect_tests(canvas); diff --git a/gm/bitmapcopy.cpp b/gm/bitmapcopy.cpp index f210b4aa5e..928b4037c1 100644 --- a/gm/bitmapcopy.cpp +++ b/gm/bitmapcopy.cpp @@ -62,14 +62,14 @@ protected: virtual void onDraw(SkCanvas* canvas) { SkPaint paint; - SkScalar horizMargin = 10; - SkScalar vertMargin = 10; + SkScalar horizMargin(SkIntToScalar(10)); + SkScalar vertMargin(SkIntToScalar(10)); - SkBitmap src; - src.allocN32Pixels(40, 40); - SkCanvas canvasTmp(src); + SkBitmapDevice devTmp(SkBitmap::kARGB_8888_Config, 40, 40, false); + SkCanvas canvasTmp(&devTmp); draw_checks(&canvasTmp, 40, 40); + SkBitmap src = canvasTmp.getTopDevice()->accessBitmap(false); for (unsigned i = 0; i < NUM_CONFIGS; ++i) { if (!src.deepCopyTo(&fDst[i], gConfigs[i])) { diff --git a/gm/bitmapsource.cpp b/gm/bitmapsource.cpp index f40cc15e90..6d575eb72e 100644 --- a/gm/bitmapsource.cpp +++ b/gm/bitmapsource.cpp @@ -23,7 +23,8 @@ protected: void makeBitmap() { fBitmap.allocN32Pixels(100, 100); - SkCanvas canvas(fBitmap); + SkBitmapDevice device(fBitmap); + SkCanvas canvas(&device); canvas.clear(0x00000000); SkPaint paint; paint.setAntiAlias(true); diff --git a/gm/deviceproperties.cpp b/gm/deviceproperties.cpp index 20839463ad..8c4649c372 100644 --- a/gm/deviceproperties.cpp +++ b/gm/deviceproperties.cpp @@ -5,7 +5,6 @@ * found in the LICENSE file. */ #include "gm.h" -#include "SkBitmapDevice.h" #include "SkTypeface.h" namespace skiagm { diff --git a/gm/displacement.cpp b/gm/displacement.cpp index b1f097b8bf..ef6207a20d 100644 --- a/gm/displacement.cpp +++ b/gm/displacement.cpp @@ -33,7 +33,8 @@ protected: void make_bitmap() { fBitmap.allocN32Pixels(80, 80); - SkCanvas canvas(fBitmap); + SkBitmapDevice device(fBitmap); + SkCanvas canvas(&device); canvas.clear(0x00000000); SkPaint paint; paint.setAntiAlias(true); @@ -45,7 +46,8 @@ protected: void make_checkerboard(SkBitmap* bitmap, int w, int h) { bitmap->allocN32Pixels(w, h); - SkCanvas canvas(*bitmap); + SkBitmapDevice device(*bitmap); + SkCanvas canvas(&device); canvas.clear(0x00000000); SkPaint darkPaint; darkPaint.setColor(0xFF804020); diff --git a/gm/gammatext.cpp b/gm/gammatext.cpp index 7ee55db2fb..99642f6e3e 100644 --- a/gm/gammatext.cpp +++ b/gm/gammatext.cpp @@ -38,14 +38,14 @@ static bool setFont(SkPaint* paint, const char name[]) { #import <ApplicationServices/ApplicationServices.h> #define BITMAP_INFO_RGB (kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Host) -static CGContextRef makeCG(const SkImageInfo& info, const void* addr, - size_t rowBytes) { - if (kPMColor_SkColorType != info.colorType() || NULL == addr) { +static CGContextRef makeCG(const SkBitmap& bm) { + if (SkBitmap::kARGB_8888_Config != bm.config() || + NULL == bm.getPixels()) { return NULL; } CGColorSpaceRef space = CGColorSpaceCreateDeviceRGB(); - CGContextRef cg = CGBitmapContextCreate((void*)addr, info.width(), info.height(), - 8, rowBytes, space, BITMAP_INFO_RGB); + CGContextRef cg = CGBitmapContextCreate(bm.getPixels(), bm.width(), bm.height(), + 8, bm.rowBytes(), space, BITMAP_INFO_RGB); CFRelease(space); CGContextSetAllowsFontSubpixelQuantization(cg, false); @@ -143,15 +143,7 @@ protected: virtual void onDraw(SkCanvas* canvas) { #ifdef SK_BUILD_FOR_MAC - CGContextRef cg = 0; - { - SkImageInfo info; - size_t rowBytes; - const void* addr = canvas->peekPixels(&info, &rowBytes); - if (addr) { - cg = makeCG(info, addr, rowBytes); - } - } + CGContextRef cg = makeCG(canvas->getDevice()->accessBitmap(false)); #endif drawGrad(canvas); @@ -1,14 +1,15 @@ + /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ - #ifndef skiagm_DEFINED #define skiagm_DEFINED #include "SkBitmap.h" +#include "SkBitmapDevice.h" #include "SkCanvas.h" #include "SkPaint.h" #include "SkSize.h" diff --git a/gm/imagefiltersclipped.cpp b/gm/imagefiltersclipped.cpp index 331ea49061..82873ab372 100644 --- a/gm/imagefiltersclipped.cpp +++ b/gm/imagefiltersclipped.cpp @@ -35,7 +35,8 @@ protected: void make_checkerboard() { fCheckerboard.allocN32Pixels(64, 64); - SkCanvas canvas(fCheckerboard); + SkBitmapDevice device(fCheckerboard); + SkCanvas canvas(&device); canvas.clear(0x00000000); SkPaint darkPaint; darkPaint.setColor(0xFF404040); @@ -57,9 +58,10 @@ protected: void make_gradient_circle(int width, int height) { SkScalar x = SkIntToScalar(width / 2); SkScalar y = SkIntToScalar(height / 2); - SkScalar radius = SkMinScalar(x, y) * 0.8f; + SkScalar radius = SkScalarMul(SkMinScalar(x, y), SkIntToScalar(4) / SkIntToScalar(5)); fGradientCircle.allocN32Pixels(width, height); - SkCanvas canvas(fGradientCircle); + SkBitmapDevice device(fGradientCircle); + SkCanvas canvas(&device); canvas.clear(0x00000000); SkColor colors[2]; colors[0] = SK_ColorWHITE; diff --git a/gm/imagefiltersgraph.cpp b/gm/imagefiltersgraph.cpp index 882918cb7b..6d5105e304 100644 --- a/gm/imagefiltersgraph.cpp +++ b/gm/imagefiltersgraph.cpp @@ -8,7 +8,6 @@ #include "gm.h" #include "SkArithmeticMode.h" -#include "SkDevice.h" #include "SkBitmapSource.h" #include "SkBlurImageFilter.h" #include "SkColorFilter.h" @@ -94,7 +93,8 @@ protected: void make_bitmap() { fBitmap.allocN32Pixels(100, 100); - SkCanvas canvas(fBitmap); + SkBitmapDevice device(fBitmap); + SkCanvas canvas(&device); canvas.clear(0x00000000); SkPaint paint; paint.setAntiAlias(true); diff --git a/gm/imagefiltersscaled.cpp b/gm/imagefiltersscaled.cpp index 28b3c9f171..a9c4a10587 100644 --- a/gm/imagefiltersscaled.cpp +++ b/gm/imagefiltersscaled.cpp @@ -35,7 +35,8 @@ protected: void make_checkerboard() { fCheckerboard.allocN32Pixels(64, 64); - SkCanvas canvas(fCheckerboard); + SkBitmapDevice device(fCheckerboard); + SkCanvas canvas(&device); canvas.clear(0x00000000); SkPaint darkPaint; darkPaint.setColor(0xFF404040); @@ -59,7 +60,8 @@ protected: SkScalar y = SkIntToScalar(height / 2); SkScalar radius = SkScalarMul(SkMinScalar(x, y), SkIntToScalar(4) / SkIntToScalar(5)); fGradientCircle.allocN32Pixels(width, height); - SkCanvas canvas(fGradientCircle); + SkBitmapDevice device(fGradientCircle); + SkCanvas canvas(&device); canvas.clear(0x00000000); SkColor colors[2]; colors[0] = SK_ColorWHITE; diff --git a/gm/lighting.cpp b/gm/lighting.cpp index 858976b90f..1cab55377a 100644 --- a/gm/lighting.cpp +++ b/gm/lighting.cpp @@ -26,7 +26,8 @@ protected: void make_bitmap() { fBitmap.allocN32Pixels(100, 100); - SkCanvas canvas(fBitmap); + SkBitmapDevice device(fBitmap); + SkCanvas canvas(&device); canvas.clear(0x00000000); SkPaint paint; paint.setAntiAlias(true); @@ -37,7 +38,7 @@ protected: } virtual SkISize onISize() { - return SkISize::Make(WIDTH, HEIGHT); + return make_isize(WIDTH, HEIGHT); } void drawClippedBitmap(SkCanvas* canvas, const SkPaint& paint, int x, int y) { diff --git a/gm/matrixconvolution.cpp b/gm/matrixconvolution.cpp index b986cc1fc0..47a3581b64 100644 --- a/gm/matrixconvolution.cpp +++ b/gm/matrixconvolution.cpp @@ -25,7 +25,8 @@ protected: void make_bitmap() { fBitmap.allocN32Pixels(80, 80); - SkCanvas canvas(fBitmap); + SkBitmapDevice device(fBitmap); + SkCanvas canvas(&device); canvas.clear(0x00000000); SkPaint paint; paint.setAntiAlias(true); diff --git a/gm/morphology.cpp b/gm/morphology.cpp index a2206b8f52..5cfb1c2902 100644 --- a/gm/morphology.cpp +++ b/gm/morphology.cpp @@ -27,7 +27,8 @@ protected: void make_bitmap() { fBitmap.allocN32Pixels(135, 135); - SkCanvas canvas(fBitmap); + SkBitmapDevice device(fBitmap); + SkCanvas canvas(&device); canvas.clear(0x0); SkPaint paint; paint.setAntiAlias(true); diff --git a/gm/ninepatchstretch.cpp b/gm/ninepatchstretch.cpp index 74cc87f305..a14af00a4e 100644 --- a/gm/ninepatchstretch.cpp +++ b/gm/ninepatchstretch.cpp @@ -13,7 +13,10 @@ static void make_bitmap(SkBitmap* bitmap, SkIRect* center) { const int kSize = 2*kFixed + kStretchy; bitmap->allocN32Pixels(kSize, kSize); - SkCanvas canvas(*bitmap); + SkBaseDevice* dev = new SkBitmapDevice(*bitmap); + + SkCanvas canvas(dev); + dev->unref(); canvas.clear(SK_ColorTRANSPARENT); SkRect r = SkRect::MakeWH(SkIntToScalar(kSize), SkIntToScalar(kSize)); diff --git a/gm/offsetimagefilter.cpp b/gm/offsetimagefilter.cpp index 0425311b0a..1b76ba2bc9 100644 --- a/gm/offsetimagefilter.cpp +++ b/gm/offsetimagefilter.cpp @@ -28,7 +28,8 @@ protected: void make_bitmap() { fBitmap.allocN32Pixels(80, 80); - SkCanvas canvas(fBitmap); + SkBitmapDevice device(fBitmap); + SkCanvas canvas(&device); canvas.clear(0x00000000); SkPaint paint; paint.setAntiAlias(true); @@ -39,8 +40,10 @@ protected: } void make_checkerboard() { - fCheckerboard.allocN32Pixels(80, 80); - SkCanvas canvas(fCheckerboard); + fCheckerboard.setConfig(SkBitmap::kARGB_8888_Config, 80, 80); + fCheckerboard.allocPixels(); + SkBitmapDevice device(fCheckerboard); + SkCanvas canvas(&device); canvas.clear(0x00000000); SkPaint darkPaint; darkPaint.setColor(0xFF404040); diff --git a/gm/peekpixels.cpp b/gm/peekpixels.cpp deleted file mode 100644 index c6744d3abe..0000000000 --- a/gm/peekpixels.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2011 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "gm.h" -#include "SkCanvas.h" -#include "SkPath.h" -#include "SkSurface.h" -#include "SkPicture.h" - -static void draw_content(SkCanvas* canvas) { - SkImageInfo info = canvas->imageInfo(); - SkPaint paint; - paint.setAntiAlias(true); - canvas->drawCircle(SkScalarHalf(info.width()), SkScalarHalf(info.height()), - SkScalarHalf(info.width()), paint); -} - -class PeekPixelsGM : public skiagm::GM { -public: - PeekPixelsGM() {} - -protected: - virtual SkString onShortName() SK_OVERRIDE { - return SkString("peekpixels"); - } - - virtual SkISize onISize() SK_OVERRIDE { - return SkISize::Make(640, 480); - } - - virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { - SkImageInfo info = SkImageInfo::MakeN32Premul(100, 100); - SkAutoTUnref<SkSurface> surface(canvas->newSurface(info)); - if (surface.get()) { - SkCanvas* surfCanvas = surface->getCanvas(); - - draw_content(surfCanvas); - SkBitmap bitmap; - - // test peekPixels - { - SkImageInfo info; - size_t rowBytes; - const void* addr = surfCanvas->peekPixels(&info, &rowBytes); - if (addr && bitmap.installPixels(info, const_cast<void*>(addr), - rowBytes, NULL, NULL)) { - canvas->drawBitmap(bitmap, 0, 0, NULL); - } - } - - // test ROCanvasPixels - canvas->translate(120, 0); - SkAutoROCanvasPixels ropixels(surfCanvas); - if (ropixels.asROBitmap(&bitmap)) { - canvas->drawBitmap(bitmap, 0, 0, NULL); - } - - // test Surface - canvas->translate(120, 0); - surface->draw(canvas, 0, 0, NULL); - } - } - - virtual uint32_t onGetFlags() const { - // we explicitly test peekPixels and readPixels, neither of which - // return something for a picture-backed canvas, so we skip that test. - return kSkipPicture_Flag; - } - -private: - typedef skiagm::GM INHERITED; -}; - -DEF_GM( return SkNEW(PeekPixelsGM); ) diff --git a/gm/tileimagefilter.cpp b/gm/tileimagefilter.cpp index 319aa3c9fa..d0acad7e69 100644 --- a/gm/tileimagefilter.cpp +++ b/gm/tileimagefilter.cpp @@ -28,7 +28,8 @@ protected: void make_bitmap() { fBitmap.allocN32Pixels(80, 80); - SkCanvas canvas(fBitmap); + SkBitmapDevice device(fBitmap); + SkCanvas canvas(&device); canvas.clear(0xFF000000); SkPaint paint; paint.setAntiAlias(true); @@ -40,7 +41,8 @@ protected: void make_checkerboard() { fCheckerboard.allocN32Pixels(80, 80); - SkCanvas canvas(fCheckerboard); + SkBitmapDevice device(fCheckerboard); + SkCanvas canvas(&device); canvas.clear(0x00000000); SkPaint darkPaint; darkPaint.setColor(0xFF404040); diff --git a/gm/xfermodeimagefilter.cpp b/gm/xfermodeimagefilter.cpp index 4469618717..f843d40dae 100644 --- a/gm/xfermodeimagefilter.cpp +++ b/gm/xfermodeimagefilter.cpp @@ -30,7 +30,8 @@ protected: void make_bitmap() { fBitmap.allocN32Pixels(80, 80); - SkCanvas canvas(fBitmap); + SkBitmapDevice device(fBitmap); + SkCanvas canvas(&device); canvas.clear(0x00000000); SkPaint paint; paint.setAntiAlias(true); @@ -42,7 +43,8 @@ protected: void make_checkerboard() { fCheckerboard.allocN32Pixels(80, 80); - SkCanvas canvas(fCheckerboard); + SkBitmapDevice device(fCheckerboard); + SkCanvas canvas(&device); canvas.clear(0x00000000); SkPaint darkPaint; darkPaint.setColor(0xFF404040); diff --git a/gyp/gmslides.gypi b/gyp/gmslides.gypi index e95f59b34c..ca3a7f6e66 100644 --- a/gyp/gmslides.gypi +++ b/gyp/gmslides.gypi @@ -121,7 +121,6 @@ '../gm/pathopsinverse.cpp', '../gm/pathopsskpclip.cpp', '../gm/pathreverse.cpp', - '../gm/peekpixels.cpp', '../gm/perlinnoise.cpp', '../gm/pictureimagefilter.cpp', '../gm/points.cpp', diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h index b6851def98..42ef8778bf 100644 --- a/include/core/SkBitmap.h +++ b/include/core/SkBitmap.h @@ -897,11 +897,4 @@ inline SkPMColor SkBitmap::getIndex8Color(int x, int y) const { return (*fColorTable)[*((const uint8_t*)fPixels + y * fRowBytes + x)]; } -/////////////////////////////////////////////////////////////////////////////// -// -// Helpers until we can fully deprecate SkBitmap::Config -// -extern SkBitmap::Config SkColorTypeToBitmapConfig(SkColorType); -extern SkColorType SkBitmapConfigToColorType(SkBitmap::Config); - #endif diff --git a/include/core/SkBitmapDevice.h b/include/core/SkBitmapDevice.h index be98c95882..e4f9b88a5e 100644 --- a/include/core/SkBitmapDevice.h +++ b/include/core/SkBitmapDevice.h @@ -82,8 +82,6 @@ public: */ virtual SkBitmap::Config config() const SK_OVERRIDE { return fBitmap.config(); } - virtual SkImageInfo imageInfo() const SK_OVERRIDE; - /** * DEPRECATED: This will be made protected once WebKit stops using it. * Instead use Canvas' writePixels method. @@ -280,7 +278,6 @@ private: virtual void flush() SK_OVERRIDE {} virtual SkSurface* newSurface(const SkImageInfo&) SK_OVERRIDE; - virtual const void* peekPixels(SkImageInfo*, size_t* rowBytes) SK_OVERRIDE; SkBitmap fBitmap; diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h index 971e4402d8..7235efb2f0 100644 --- a/include/core/SkCanvas.h +++ b/include/core/SkCanvas.h @@ -76,12 +76,6 @@ public: SkMetaData& getMetaData(); - /** - * Return ImageInfo for this canvas. If the canvas is not backed by pixels - * (cpu or gpu), then the info's ColorType will be kUnknown_SkColorType. - */ - SkImageInfo imageInfo() const; - /////////////////////////////////////////////////////////////////////////// /** @@ -90,19 +84,16 @@ public: void flush(); /** - * DEPRECATED: call imageInfo() instead. * Return the width/height of the underlying device. The current drawable * area may be small (due to clipping or saveLayer). For a canvas with * no device, 0,0 will be returned. */ SkISize getDeviceSize() const; - /** - * DEPRECATED. - * Return the canvas' device object, which may be null. The device holds - * the bitmap of the pixels that the canvas draws into. The reference count - * of the returned device is not changed by this call. - */ + /** Return the canvas' device object, which may be null. The device holds + the bitmap of the pixels that the canvas draws into. The reference count + of the returned device is not changed by this call. + */ SkBaseDevice* getDevice() const; /** @@ -135,20 +126,6 @@ public: /////////////////////////////////////////////////////////////////////////// /** - * If the canvas has pixels (and is not recording to a picture or other - * non-raster target) and has direct access to its pixels (i.e. they are in - * local RAM) return the const-address of those pixels, and if not null, - * return the ImageInfo and rowBytes. The returned address is only valid - * while the canvas object is in scope and unchanged. Any API calls made on - * canvas (or its parent surface if any) will invalidate the - * returned address (and associated information). - * - * On failure, returns NULL and the info and rowBytes parameters are - * ignored. - */ - const void* peekPixels(SkImageInfo* info, size_t* rowBytes); - - /** * This enum can be used with read/writePixels to perform a pixel ops to or * from an 8888 config other than Skia's native config (SkPMColor). There * are three byte orders supported: native, BGRA, and RGBA. Each has a @@ -1042,9 +1019,6 @@ protected: // default impl defers to getDevice()->newSurface(info) virtual SkSurface* onNewSurface(const SkImageInfo&); - // default impl defers to its device - virtual const void* onPeekPixels(SkImageInfo*, size_t* rowBytes); - // Returns the canvas to be used by DrawIter. Default implementation // returns this. Subclasses that encapsulate an indirect canvas may // need to overload this method. The impl must keep track of this, as it @@ -1232,47 +1206,4 @@ private: }; #define SkAutoCommentBlock(...) SK_REQUIRE_LOCAL_VAR(SkAutoCommentBlock) -/** - * If the caller wants read-only access to the pixels in a canvas, it can just - * call canvas->peekPixels(), since that is the fastest way to "peek" at the - * pixels on a raster-backed canvas. - * - * If the canvas has pixels, but they are not readily available to the CPU - * (e.g. gpu-backed), then peekPixels() will fail, but readPixels() will - * succeed (though be slower, since it will return a copy of the pixels). - * - * SkAutoROCanvasPixels encapsulates these two techniques, trying first to call - * peekPixels() (for performance), but if that fails, calling readPixels() and - * storing the copy locally. - * - * The caller must respect the restrictions associated with peekPixels(), since - * that may have been called: The returned information is invalidated if... - * - any API is called on the canvas (or its parent surface if present) - * - the canvas goes out of scope - */ -class SkAutoROCanvasPixels : SkNoncopyable { -public: - SkAutoROCanvasPixels(SkCanvas* canvas); - - // returns NULL on failure - const void* addr() const { return fAddr; } - - // undefined if addr() == NULL - size_t rowBytes() const { return fRowBytes; } - - // undefined if addr() == NULL - const SkImageInfo& info() const { return fInfo; } - - // helper that, if returns true, installs the pixels into the bitmap. Note - // that the bitmap may reference the address returned by peekPixels(), so - // the caller must respect the restrictions associated with peekPixels(). - bool asROBitmap(SkBitmap*) const; - -private: - SkBitmap fBitmap; // used if peekPixels() fails - const void* fAddr; // NULL on failure - SkImageInfo fInfo; - size_t fRowBytes; -}; - #endif diff --git a/include/core/SkDevice.h b/include/core/SkDevice.h index e3a23be6ca..016e2babc8 100644 --- a/include/core/SkDevice.h +++ b/include/core/SkDevice.h @@ -77,12 +77,6 @@ public: } /** - * Return ImageInfo for this device. If the canvas is not backed by pixels - * (cpu or gpu), then the info's ColorType will be kUnknown_SkColorType. - */ - virtual SkImageInfo imageInfo() const; - - /** * Return the bounds of the device in the coordinate space of the root * canvas. The root device will have its top-left at 0,0, but other devices * such as those associated with saveLayer may have a non-zero origin. @@ -375,10 +369,7 @@ protected: protected: // default impl returns NULL virtual SkSurface* newSurface(const SkImageInfo&); - - // default impl returns NULL - virtual const void* peekPixels(SkImageInfo*, size_t* rowBytes); - + /** * Leaky properties are those which the device should be applying but it isn't. * These properties will be applied by the draw, when and as it can. diff --git a/include/core/SkSurface.h b/include/core/SkSurface.h index 74c5f083f4..2f277b755d 100644 --- a/include/core/SkSurface.h +++ b/include/core/SkSurface.h @@ -151,18 +151,6 @@ public: */ void draw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*); - /** - * If the surface has direct access to its pixels (i.e. they are in local - * RAM) return the const-address of those pixels, and if not null, return - * the ImageInfo and rowBytes. The returned address is only valid while - * the surface object is in scope, and no API call is made on the surface - * or its canvas. - * - * On failure, returns NULL and the info and rowBytes parameters are - * ignored. - */ - const void* peekPixels(SkImageInfo* info, size_t* rowBytes); - protected: SkSurface(int width, int height); SkSurface(const SkImageInfo&); diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp index 15e56a3bb6..53e15a5fdf 100644 --- a/samplecode/SampleApp.cpp +++ b/samplecode/SampleApp.cpp @@ -1128,9 +1128,8 @@ void SampleWindow::listTitles() { static SkBitmap capture_bitmap(SkCanvas* canvas) { SkBitmap bm; - if (bm.allocPixels(canvas->imageInfo())) { - canvas->readPixels(&bm, 0, 0); - } + const SkBitmap& src = canvas->getDevice()->accessBitmap(false); + src.copyTo(&bm, src.config()); return bm; } diff --git a/samplecode/SampleCircle.cpp b/samplecode/SampleCircle.cpp index 9cc927e47d..b101a1f257 100644 --- a/samplecode/SampleCircle.cpp +++ b/samplecode/SampleCircle.cpp @@ -71,6 +71,12 @@ protected: } } + static void blowup(SkCanvas* canvas, const SkIRect& src, const SkRect& dst) { + SkBaseDevice* device = canvas->getDevice(); + const SkBitmap& bm = device->accessBitmap(false); + canvas->drawBitmapRect(bm, &src, dst, NULL); + } + static void make_poly(SkPath* path, int n) { if (n <= 0) { return; diff --git a/samplecode/SampleLayers.cpp b/samplecode/SampleLayers.cpp index bc8b8730bb..483943d5d4 100644 --- a/samplecode/SampleLayers.cpp +++ b/samplecode/SampleLayers.cpp @@ -42,10 +42,10 @@ static void dump_layers(const char label[], SkCanvas* canvas) { SkCanvas::LayerIter iter(canvas, true); int index = 0; while (!iter.done()) { - SkImageInfo info = iter.device()->imageInfo(); + const SkBitmap& bm = iter.device()->accessBitmap(false); const SkIRect& clip = iter.clip().getBounds(); SkDebugf("Layer[%d] bitmap [%d %d] X=%d Y=%d clip=[%d %d %d %d] alpha=%d\n", index++, - info.width(), info.height(), iter.x(), iter.y(), + bm.width(), bm.height(), iter.x(), iter.y(), clip.fLeft, clip.fTop, clip.fRight, clip.fBottom, iter.paint().getAlpha()); iter.next(); diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp index 374bef98c1..9dde6e172e 100644 --- a/src/core/SkBitmapDevice.cpp +++ b/src/core/SkBitmapDevice.cpp @@ -54,10 +54,6 @@ SkBitmapDevice::SkBitmapDevice(SkBitmap::Config config, int width, int height, b SkBitmapDevice::~SkBitmapDevice() { } -SkImageInfo SkBitmapDevice::imageInfo() const { - return fBitmap.info(); -} - void SkBitmapDevice::replaceBitmapBackendForRasterSurface(const SkBitmap& bm) { SkASSERT(bm.width() == fBitmap.width()); SkASSERT(bm.height() == fBitmap.height()); @@ -390,16 +386,6 @@ SkSurface* SkBitmapDevice::newSurface(const SkImageInfo& info) { return SkSurface::NewRaster(info); } -const void* SkBitmapDevice::peekPixels(SkImageInfo* info, size_t* rowBytes) { - if (fBitmap.getPixels() && fBitmap.asImageInfo(info)) { - if (rowBytes) { - *rowBytes = fBitmap.rowBytes(); - } - return fBitmap.getPixels(); - } - return NULL; -} - /////////////////////////////////////////////////////////////////////////////// bool SkBitmapDevice::filterTextFlags(const SkPaint& paint, TextFlags* flags) { diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp index f5e91ffc43..ed8274dc5d 100644 --- a/src/core/SkCanvas.cpp +++ b/src/core/SkCanvas.cpp @@ -992,55 +992,6 @@ SkSurface* SkCanvas::onNewSurface(const SkImageInfo& info) { return dev ? dev->newSurface(info) : NULL; } -SkImageInfo SkCanvas::imageInfo() const { - SkBaseDevice* dev = this->getDevice(); - if (dev) { - return dev->imageInfo(); - } else { - // TODO: need a real unknown for alphatype it seems. - SkAlphaType unknownAlphaType = kIgnore_SkAlphaType; - return SkImageInfo::Make(0, 0, kUnknown_SkColorType, unknownAlphaType); - } -} - -const void* SkCanvas::peekPixels(SkImageInfo* info, size_t* rowBytes) { - return this->onPeekPixels(info, rowBytes); -} - -const void* SkCanvas::onPeekPixels(SkImageInfo* info, size_t* rowBytes) { - SkBaseDevice* dev = this->getDevice(); - return dev ? dev->peekPixels(info, rowBytes) : NULL; -} - -SkAutoROCanvasPixels::SkAutoROCanvasPixels(SkCanvas* canvas) { - fAddr = canvas->peekPixels(&fInfo, &fRowBytes); - if (NULL == fAddr) { - fInfo = canvas->imageInfo(); - if (kUnknown_SkColorType == fInfo.colorType() || - !fBitmap.allocPixels(fInfo)) - { - return; // failure, fAddr is NULL - } - fBitmap.lockPixels(); - if (!canvas->readPixels(&fBitmap, 0, 0)) { - return; // failure, fAddr is NULL - } - fAddr = fBitmap.getPixels(); - fRowBytes = fBitmap.rowBytes(); - } - SkASSERT(fAddr); // success -} - -bool SkAutoROCanvasPixels::asROBitmap(SkBitmap* bitmap) const { - if (fAddr) { - return bitmap->installPixels(fInfo, const_cast<void*>(fAddr), fRowBytes, - NULL, NULL); - } else { - bitmap->reset(); - return false; - } -} - ///////////////////////////////////////////////////////////////////////////// void SkCanvas::internalDrawBitmap(const SkBitmap& bitmap, diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp index 364b106dd8..9ce8b6b5df 100644 --- a/src/core/SkDevice.cpp +++ b/src/core/SkDevice.cpp @@ -65,12 +65,6 @@ SkMetaData& SkBaseDevice::getMetaData() { return *fMetaData; } -// TODO: should make this guy pure-virtual. -SkImageInfo SkBaseDevice::imageInfo() const { - return SkImageInfo::Make(this->width(), this->height(), - kUnknown_SkColorType, kIgnore_SkAlphaType); -} - const SkBitmap& SkBaseDevice::accessBitmap(bool changePixels) { const SkBitmap& bitmap = this->onAccessBitmap(); if (changePixels) { @@ -123,5 +117,3 @@ bool SkBaseDevice::readPixels(SkBitmap* bitmap, int x, int y, } SkSurface* SkBaseDevice::newSurface(const SkImageInfo&) { return NULL; } - -const void* SkBaseDevice::peekPixels(SkImageInfo*, size_t*) { return NULL; } diff --git a/src/core/SkPictureRecord.h b/src/core/SkPictureRecord.h index eaa5e73008..0df120b31a 100644 --- a/src/core/SkPictureRecord.h +++ b/src/core/SkPictureRecord.h @@ -221,9 +221,6 @@ public: protected: virtual SkSurface* onNewSurface(const SkImageInfo&) SK_OVERRIDE; - const void* onPeekPixels(SkImageInfo*, size_t*) SK_OVERRIDE { - return NULL; - } // Return fontmetrics.fTop,fBottom in topbot[0,1], after they have been // tweaked by paint.computeFastBounds(). diff --git a/src/image/SkImagePriv.h b/src/image/SkImagePriv.h index bf28f598c5..8883e2c070 100644 --- a/src/image/SkImagePriv.h +++ b/src/image/SkImagePriv.h @@ -14,6 +14,8 @@ class SkPicture; extern SkBitmap::Config SkImageInfoToBitmapConfig(const SkImageInfo&); +extern SkBitmap::Config SkColorTypeToBitmapConfig(SkColorType); +extern SkColorType SkBitmapConfigToColorType(SkBitmap::Config); // Call this if you explicitly want to use/share this pixelRef in the image extern SkImage* SkNewImageFromPixelRef(const SkImageInfo&, SkPixelRef*, diff --git a/src/image/SkSurface.cpp b/src/image/SkSurface.cpp index 4b5fb68134..cb029c8aea 100644 --- a/src/image/SkSurface.cpp +++ b/src/image/SkSurface.cpp @@ -121,8 +121,3 @@ void SkSurface::draw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint) { return asSB(this)->onDraw(canvas, x, y, paint); } - -const void* SkSurface::peekPixels(SkImageInfo* info, size_t* rowBytes) { - return this->getCanvas()->peekPixels(info, rowBytes); -} - diff --git a/tests/SkpSkGrTest.cpp b/tests/SkpSkGrTest.cpp index d1d38dfe8e..02aabbe2af 100644 --- a/tests/SkpSkGrTest.cpp +++ b/tests/SkpSkGrTest.cpp @@ -453,11 +453,7 @@ void TestResult::testOne() { SkGpuDevice grDevice(context, texture.get()); SkCanvas grCanvas(&grDevice); drawPict(pic, &grCanvas, fScaleOversized ? scale : 1); - - SkBitmap grBitmap; - grBitmap.allocPixels(grCanvas.imageInfo()); - grCanvas.readPixels(&grBitmap, 0, 0); - + const SkBitmap& grBitmap = grDevice.accessBitmap(false); if (fTestStep == kCompareBits) { fPixelError = similarBits(grBitmap, bitmap); int skTime = timePict(pic, &skCanvas); diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp index fcd0986460..aa457c7dcc 100644 --- a/tests/SurfaceTest.cpp +++ b/tests/SurfaceTest.cpp @@ -22,37 +22,27 @@ class GrContext; enum SurfaceType { kRaster_SurfaceType, - kRasterDirect_SurfaceType, kGpu_SurfaceType, kPicture_SurfaceType }; -static const int gSurfaceSize = 10; -static SkPMColor gSurfaceStorage[gSurfaceSize * gSurfaceSize]; - -static SkSurface* createSurface(SurfaceType surfaceType, GrContext* context, - SkImageInfo* requestedInfo = NULL) { - static const SkImageInfo info = SkImageInfo::MakeN32Premul(gSurfaceSize, - gSurfaceSize); - - if (requestedInfo) { - *requestedInfo = info; - } +static SkSurface* createSurface(SurfaceType surfaceType, GrContext* context) { + static const SkImageInfo info = SkImageInfo::MakeN32Premul(10, 10); switch (surfaceType) { - case kRaster_SurfaceType: - return SkSurface::NewRaster(info); - case kRasterDirect_SurfaceType: - return SkSurface::NewRasterDirect(info, gSurfaceStorage, - info.minRowBytes()); - case kGpu_SurfaceType: + case kRaster_SurfaceType: + return SkSurface::NewRaster(info); + case kGpu_SurfaceType: #if SK_SUPPORT_GPU - return context ? SkSurface::NewRenderTarget(context, info) : NULL; + SkASSERT(NULL != context); + return SkSurface::NewRenderTarget(context, info); +#else + SkASSERT(0); #endif - break; - case kPicture_SurfaceType: - return SkSurface::NewPicture(info.fWidth, info.fHeight); + case kPicture_SurfaceType: + return SkSurface::NewPicture(info.fWidth, info.fHeight); } + SkASSERT(0); return NULL; } @@ -127,14 +117,14 @@ static void test_imagepeek(skiatest::Reporter* reporter) { { kPicture_ImageType, false }, { kCodec_ImageType, false }, }; - + const SkColor color = SK_ColorRED; const SkPMColor pmcolor = SkPreMultiplyColor(color); - + for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); ++i) { SkImageInfo info; size_t rowBytes; - + SkAutoTUnref<SkImage> image(createImage(gRec[i].fType, NULL, color)); if (!image.get()) { continue; // gpu may not be enabled @@ -147,65 +137,13 @@ static void test_imagepeek(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, 10 == info.fHeight); REPORTER_ASSERT(reporter, kPMColor_SkColorType == info.fColorType); REPORTER_ASSERT(reporter, kPremul_SkAlphaType == info.fAlphaType || - kOpaque_SkAlphaType == info.fAlphaType); + kOpaque_SkAlphaType == info.fAlphaType); REPORTER_ASSERT(reporter, info.minRowBytes() <= rowBytes); REPORTER_ASSERT(reporter, pmcolor == *(const SkPMColor*)addr); } } } -static void test_canvaspeek(skiatest::Reporter* reporter, - GrContextFactory* factory) { - static const struct { - SurfaceType fType; - bool fPeekShouldSucceed; - } gRec[] = { - { kRaster_SurfaceType, true }, - { kRasterDirect_SurfaceType, true }, -#if SK_SUPPORT_GPU - { kGpu_SurfaceType, false }, -#endif - { kPicture_SurfaceType, false }, - }; - - const SkColor color = SK_ColorRED; - const SkPMColor pmcolor = SkPreMultiplyColor(color); - - GrContext* context = NULL; -#if SK_SUPPORT_GPU - context = factory->get(GrContextFactory::kNative_GLContextType); -#endif - - for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); ++i) { - SkImageInfo info, requestInfo; - size_t rowBytes; - - SkAutoTUnref<SkSurface> surface(createSurface(gRec[i].fType, context, - &requestInfo)); - surface->getCanvas()->clear(color); - - const void* addr = surface->getCanvas()->peekPixels(&info, &rowBytes); - bool success = (NULL != addr); - REPORTER_ASSERT(reporter, gRec[i].fPeekShouldSucceed == success); - - SkImageInfo info2; - size_t rb2; - const void* addr2 = surface->peekPixels(&info2, &rb2); - - if (success) { - REPORTER_ASSERT(reporter, requestInfo == info); - REPORTER_ASSERT(reporter, requestInfo.minRowBytes() <= rowBytes); - REPORTER_ASSERT(reporter, pmcolor == *(const SkPMColor*)addr); - - REPORTER_ASSERT(reporter, addr2 == addr); - REPORTER_ASSERT(reporter, info2 == info); - REPORTER_ASSERT(reporter, rb2 == rowBytes); - } else { - REPORTER_ASSERT(reporter, NULL == addr2); - } - } -} - static void TestSurfaceCopyOnWrite(skiatest::Reporter* reporter, SurfaceType surfaceType, GrContext* context) { // Verify that the right canvas commands trigger a copy on write @@ -397,10 +335,7 @@ DEF_GPUTEST(Surface, reporter, factory) { TestSurfaceWritableAfterSnapshotRelease(reporter, kPicture_SurfaceType, NULL); TestSurfaceNoCanvas(reporter, kRaster_SurfaceType, NULL, SkSurface::kDiscard_ContentChangeMode); TestSurfaceNoCanvas(reporter, kRaster_SurfaceType, NULL, SkSurface::kRetain_ContentChangeMode); - test_imagepeek(reporter); - test_canvaspeek(reporter, factory); - #if SK_SUPPORT_GPU TestGetTexture(reporter, kRaster_SurfaceType, NULL); TestGetTexture(reporter, kPicture_SurfaceType, NULL); |