aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--bench/BlurImageFilterBench.cpp2
-rw-r--r--bench/DeferredCanvasBench.cpp2
-rw-r--r--bench/DisplacementBench.cpp4
-rw-r--r--bench/MagnifierBench.cpp2
-rw-r--r--bench/MergeBench.cpp4
-rw-r--r--bench/benchmain.cpp10
-rw-r--r--debugger/QT/SkRasterWidget.cpp4
-rw-r--r--debugger/QT/SkRasterWidget.h2
-rw-r--r--experimental/PdfViewer/SkNulCanvas.h4
-rw-r--r--experimental/PdfViewer/SkPdfRenderer.cpp4
-rw-r--r--experimental/PdfViewer/SkTrackDevice.h14
-rw-r--r--experimental/PdfViewer/pdf_viewer_main.cpp6
-rw-r--r--experimental/SkiaExamples/SkExample.cpp2
-rw-r--r--experimental/iOSSampleApp/SkSampleUIView.mm4
-rw-r--r--gm/bitmapcopy.cpp2
-rw-r--r--gm/deviceproperties.cpp2
-rw-r--r--gm/displacement.cpp4
-rw-r--r--gm/extractbitmap.cpp2
-rw-r--r--gm/gmmain.cpp4
-rw-r--r--gm/imagefiltersgraph.cpp2
-rw-r--r--gm/lighting.cpp2
-rw-r--r--gm/matrixconvolution.cpp2
-rw-r--r--gm/morphology.cpp2
-rw-r--r--gm/ninepatchstretch.cpp4
-rw-r--r--gm/srcmode.cpp2
-rw-r--r--gm/texdata.cpp2
-rw-r--r--gm/xfermodeimagefilter.cpp4
-rw-r--r--gm/xfermodes3.cpp2
-rw-r--r--include/core/SkCanvas.h26
-rw-r--r--include/core/SkDevice.h451
-rw-r--r--include/core/SkDraw.h4
-rw-r--r--include/core/SkImageFilter.h4
-rw-r--r--include/core/SkRRect.h2
-rw-r--r--include/device/xps/SkXPSDevice.h17
-rw-r--r--include/gpu/SkGpuDevice.h24
-rw-r--r--include/pdf/SkPDFDevice.h16
-rw-r--r--include/utils/SkDeferredCanvas.h2
-rw-r--r--samplecode/SampleApp.cpp4
-rw-r--r--samplecode/SampleApp.h2
-rw-r--r--samplecode/SampleCircle.cpp2
-rw-r--r--samplecode/SampleTextureDomain.cpp2
-rw-r--r--src/core/SkBBoxHierarchyRecord.cpp2
-rw-r--r--src/core/SkBBoxHierarchyRecord.h2
-rw-r--r--src/core/SkBBoxRecord.h2
-rw-r--r--src/core/SkCanvas.cpp58
-rw-r--r--src/core/SkDevice.cpp202
-rw-r--r--src/core/SkDeviceImageFilterProxy.h6
-rw-r--r--src/core/SkPicture.cpp2
-rw-r--r--src/core/SkPictureRecord.cpp4
-rw-r--r--src/core/SkPictureRecord.h4
-rw-r--r--src/device/xps/SkXPSDevice.cpp16
-rwxr-xr-xsrc/effects/SkColorFilterImageFilter.cpp2
-rw-r--r--src/effects/SkDropShadowImageFilter.cpp2
-rwxr-xr-xsrc/effects/SkMergeImageFilter.cpp2
-rw-r--r--src/effects/SkRectShaderImageFilter.cpp4
-rwxr-xr-xsrc/effects/SkTestImageFilters.cpp8
-rw-r--r--src/gpu/SkGpuDevice.cpp20
-rw-r--r--src/pdf/SkPDFDevice.cpp16
-rw-r--r--src/pipe/SkGPipeWrite.cpp2
-rw-r--r--src/pipe/utils/SamplePipeControllers.cpp2
-rw-r--r--src/utils/SkDeferredCanvas.cpp50
-rw-r--r--src/utils/SkPictureUtils.cpp11
-rw-r--r--tests/CanvasTest.cpp10
-rw-r--r--tests/DeferredCanvasTest.cpp26
-rw-r--r--tests/GradientTest.cpp2
-rw-r--r--tests/LayerDrawLooperTest.cpp9
-rw-r--r--tests/PremulAlphaRoundTripTest.cpp10
-rw-r--r--tests/ReadPixelsTest.cpp5
-rw-r--r--tests/ReadWriteAlphaTest.cpp2
-rw-r--r--tests/TileGridTest.cpp30
-rw-r--r--tests/WritePixelsTest.cpp8
71 files changed, 468 insertions, 707 deletions
diff --git a/bench/BlurImageFilterBench.cpp b/bench/BlurImageFilterBench.cpp
index beaa96824a..1666f57b93 100644
--- a/bench/BlurImageFilterBench.cpp
+++ b/bench/BlurImageFilterBench.cpp
@@ -53,7 +53,7 @@ private:
const int h = fIsSmall ? FILTER_HEIGHT_LARGE : FILTER_HEIGHT_LARGE;
fCheckerboard.setConfig(SkBitmap::kARGB_8888_Config, w, h);
fCheckerboard.allocPixels();
- SkBitmapDevice device(fCheckerboard);
+ SkDevice device(fCheckerboard);
SkCanvas canvas(&device);
canvas.clear(0x00000000);
SkPaint darkPaint;
diff --git a/bench/DeferredCanvasBench.cpp b/bench/DeferredCanvasBench.cpp
index e14bb24cf8..9e7e723821 100644
--- a/bench/DeferredCanvasBench.cpp
+++ b/bench/DeferredCanvasBench.cpp
@@ -26,7 +26,7 @@ protected:
}
virtual void onDraw(SkCanvas* canvas) {
- SkBaseDevice *device = canvas->getDevice()->createCompatibleDevice(
+ SkDevice *device = canvas->getDevice()->createCompatibleDevice(
SkBitmap::kARGB_8888_Config, CANVAS_WIDTH, CANVAS_HEIGHT, false);
SkAutoTUnref<SkDeferredCanvas> deferredCanvas(SkDeferredCanvas::Create(device));
diff --git a/bench/DisplacementBench.cpp b/bench/DisplacementBench.cpp
index 8f1483a50a..5adec1f706 100644
--- a/bench/DisplacementBench.cpp
+++ b/bench/DisplacementBench.cpp
@@ -35,7 +35,7 @@ protected:
const int h = isSmall() ? FILTER_HEIGHT_LARGE : FILTER_HEIGHT_LARGE;
fBitmap.setConfig(SkBitmap::kARGB_8888_Config, w, h);
fBitmap.allocPixels();
- SkBitmapDevice device(fBitmap);
+ SkDevice device(fBitmap);
SkCanvas canvas(&device);
canvas.clear(0x00000000);
SkPaint paint;
@@ -51,7 +51,7 @@ protected:
const int h = isSmall() ? FILTER_HEIGHT_LARGE : FILTER_HEIGHT_LARGE;
fCheckerboard.setConfig(SkBitmap::kARGB_8888_Config, w, h);
fCheckerboard.allocPixels();
- SkBitmapDevice device(fCheckerboard);
+ SkDevice device(fCheckerboard);
SkCanvas canvas(&device);
canvas.clear(0x00000000);
SkPaint darkPaint;
diff --git a/bench/MagnifierBench.cpp b/bench/MagnifierBench.cpp
index 11f6af8a67..969323a791 100644
--- a/bench/MagnifierBench.cpp
+++ b/bench/MagnifierBench.cpp
@@ -52,7 +52,7 @@ private:
const int h = fIsSmall ? FILTER_HEIGHT_LARGE : FILTER_HEIGHT_LARGE;
fCheckerboard.setConfig(SkBitmap::kARGB_8888_Config, w, h);
fCheckerboard.allocPixels();
- SkBitmapDevice device(fCheckerboard);
+ SkDevice device(fCheckerboard);
SkCanvas canvas(&device);
canvas.clear(0x00000000);
SkPaint darkPaint;
diff --git a/bench/MergeBench.cpp b/bench/MergeBench.cpp
index 170b84908d..3639c954a2 100644
--- a/bench/MergeBench.cpp
+++ b/bench/MergeBench.cpp
@@ -53,7 +53,7 @@ private:
void make_bitmap() {
fBitmap.setConfig(SkBitmap::kARGB_8888_Config, 80, 80);
fBitmap.allocPixels();
- SkBitmapDevice device(fBitmap);
+ SkDevice device(fBitmap);
SkCanvas canvas(&device);
canvas.clear(0x00000000);
SkPaint paint;
@@ -67,7 +67,7 @@ private:
void make_checkerboard() {
fCheckerboard.setConfig(SkBitmap::kARGB_8888_Config, 80, 80);
fCheckerboard.allocPixels();
- SkBitmapDevice device(fCheckerboard);
+ SkDevice device(fCheckerboard);
SkCanvas canvas(&device);
canvas.clear(0x00000000);
SkPaint darkPaint;
diff --git a/bench/benchmain.cpp b/bench/benchmain.cpp
index 8a3d2138d8..9cb7468be0 100644
--- a/bench/benchmain.cpp
+++ b/bench/benchmain.cpp
@@ -193,9 +193,9 @@ enum Backend {
kPDF_Backend,
};
-static SkBaseDevice* make_device(SkBitmap::Config config, const SkIPoint& size,
- Backend backend, int sampleCount, GrContext* context) {
- SkBaseDevice* device = NULL;
+static SkDevice* make_device(SkBitmap::Config config, const SkIPoint& size,
+ Backend backend, int sampleCount, GrContext* context) {
+ SkDevice* device = NULL;
SkBitmap bitmap;
bitmap.setConfig(config, size.fX, size.fY);
@@ -203,7 +203,7 @@ static SkBaseDevice* make_device(SkBitmap::Config config, const SkIPoint& size,
case kRaster_Backend:
bitmap.allocPixels();
erase(bitmap);
- device = SkNEW_ARGS(SkBitmapDevice, (bitmap));
+ device = SkNEW_ARGS(SkDevice, (bitmap));
break;
#if SK_SUPPORT_GPU
case kGPU_Backend: {
@@ -776,7 +776,7 @@ int tool_main(int argc, char** argv) {
glContext = gContextFactory.getGLContext(gConfigs[configIndex].fContextType);
}
#endif
- SkBaseDevice* device = NULL;
+ SkDevice* device = NULL;
SkCanvas* canvas = NULL;
SkPicture pictureRecordFrom;
SkPicture pictureRecordTo;
diff --git a/debugger/QT/SkRasterWidget.cpp b/debugger/QT/SkRasterWidget.cpp
index d78e5f8559..3817c0e0ee 100644
--- a/debugger/QT/SkRasterWidget.cpp
+++ b/debugger/QT/SkRasterWidget.cpp
@@ -12,7 +12,7 @@ SkRasterWidget::SkRasterWidget(SkDebugger *debugger) : QWidget() {
fBitmap.setConfig(SkBitmap::kARGB_8888_Config, 800, 800);
fBitmap.allocPixels();
fBitmap.eraseColor(SK_ColorTRANSPARENT);
- fDevice = new SkBitmapDevice(fBitmap);
+ fDevice = new SkDevice(fBitmap);
fDebugger = debugger;
fCanvas = new SkCanvas(fDevice);
this->setStyleSheet("QWidget {background-color: white; border: 1px solid #cccccc;}");
@@ -29,7 +29,7 @@ void SkRasterWidget::resizeEvent(QResizeEvent* event) {
fBitmap.eraseColor(SK_ColorTRANSPARENT);
SkSafeUnref(fCanvas);
SkSafeUnref(fDevice);
- fDevice = new SkBitmapDevice(fBitmap);
+ fDevice = new SkDevice(fBitmap);
fCanvas = new SkCanvas(fDevice);
fDebugger->resize(event->size().width(), event->size().height());
this->update();
diff --git a/debugger/QT/SkRasterWidget.h b/debugger/QT/SkRasterWidget.h
index 9e4f01d506..769aa51032 100644
--- a/debugger/QT/SkRasterWidget.h
+++ b/debugger/QT/SkRasterWidget.h
@@ -44,7 +44,7 @@ private:
SkBitmap fBitmap;
SkDebugger* fDebugger;
SkCanvas* fCanvas;
- SkBaseDevice* fDevice;
+ SkDevice* fDevice;
};
#endif /* SKRASTERWIDGET_H_ */
diff --git a/experimental/PdfViewer/SkNulCanvas.h b/experimental/PdfViewer/SkNulCanvas.h
index 612251229e..27dd9910ac 100644
--- a/experimental/PdfViewer/SkNulCanvas.h
+++ b/experimental/PdfViewer/SkNulCanvas.h
@@ -8,7 +8,7 @@ public:
SK_DECLARE_INST_COUNT(SkNulCanvas);
SkNulCanvas() {}
- explicit SkNulCanvas(SkBaseDevice* device) : SkCanvas(device) {}
+ explicit SkNulCanvas(SkDevice* device) : SkCanvas(device) {}
explicit SkNulCanvas(const SkBitmap& bitmap) : SkCanvas(bitmap) {}
virtual ~SkNulCanvas() {}
@@ -83,7 +83,7 @@ public:
protected:
virtual SkCanvas* canvasForDrawIter() {return NULL;}
- virtual SkBaseDevice* setDevice(SkBaseDevice* device) {return NULL;}
+ virtual SkDevice* setDevice(SkDevice* device) {return NULL;}
private:
typedef SkCanvas INHERITED;
diff --git a/experimental/PdfViewer/SkPdfRenderer.cpp b/experimental/PdfViewer/SkPdfRenderer.cpp
index 22f274aeb9..ef13c55305 100644
--- a/experimental/PdfViewer/SkPdfRenderer.cpp
+++ b/experimental/PdfViewer/SkPdfRenderer.cpp
@@ -242,7 +242,7 @@ static bool readToken(SkPdfNativeTokenizer* fTokenizer, PdfToken* token) {
memcpy(bitmap.getPixels(), gDumpBitmap->getPixels(), gDumpBitmap->getSize());
- SkAutoTUnref<SkBaseDevice> device(SkNEW_ARGS(SkBitmapDevice, (bitmap)));
+ SkAutoTUnref<SkDevice> device(SkNEW_ARGS(SkDevice, (bitmap)));
SkCanvas canvas(device);
// draw context stuff here
@@ -2641,7 +2641,7 @@ bool SkPDFNativeRenderToBitmap(SkStream* stream,
setup_bitmap(output, (int)SkScalarToDouble(width), (int)SkScalarToDouble(height));
- SkAutoTUnref<SkBaseDevice> device(SkNEW_ARGS(SkBitmapDevice, (*output)));
+ SkAutoTUnref<SkDevice> device(SkNEW_ARGS(SkDevice, (*output)));
SkCanvas canvas(device);
return renderer.renderPage(page, &canvas, rect);
diff --git a/experimental/PdfViewer/SkTrackDevice.h b/experimental/PdfViewer/SkTrackDevice.h
index b8c36d995b..6f26121d18 100644
--- a/experimental/PdfViewer/SkTrackDevice.h
+++ b/experimental/PdfViewer/SkTrackDevice.h
@@ -4,24 +4,24 @@
#include "SkDevice.h"
#include "SkTracker.h"
-class SkTrackDevice : public SkBitmapDevice {
+class SkTrackDevice : public SkDevice {
public:
SK_DECLARE_INST_COUNT(SkTrackDevice)
- SkTrackDevice(const SkBitmap& bitmap) : SkBitmapDevice(bitmap)
+ SkTrackDevice(const SkBitmap& bitmap) : SkDevice(bitmap)
, fTracker(NULL) {}
SkTrackDevice(const SkBitmap& bitmap, const SkDeviceProperties& deviceProperties)
- : SkBitmapDevice(bitmap, deviceProperties)
+ : SkDevice(bitmap, deviceProperties)
, fTracker(NULL) {}
SkTrackDevice(SkBitmap::Config config, int width, int height, bool isOpaque = false)
- : SkBitmapDevice(config, width, height, isOpaque)
+ : SkDevice(config, width, height, isOpaque)
, fTracker(NULL) {}
SkTrackDevice(SkBitmap::Config config, int width, int height, bool isOpaque,
const SkDeviceProperties& deviceProperties)
- : SkBitmapDevice(config, width, height, isOpaque, deviceProperties)
+ : SkDevice(config, width, height, isOpaque, deviceProperties)
, fTracker(NULL) {}
virtual ~SkTrackDevice() {}
@@ -147,7 +147,7 @@ protected:
after();
}
- virtual void drawDevice(const SkDraw& dummy1, SkBaseDevice* dummy2, int x, int y,
+ virtual void drawDevice(const SkDraw& dummy1, SkDevice* dummy2, int x, int y,
const SkPaint& dummy3) {
before();
INHERITED::drawDevice(dummy1, dummy2, x, y, dummy3);
@@ -171,7 +171,7 @@ private:
private:
SkTracker* fTracker;
- typedef SkBitmapDevice INHERITED;
+ typedef SkDevice INHERITED;
};
#endif // EXPERIMENTAL_PDFVIEWER_SKTRACKDEVICE_H_
diff --git a/experimental/PdfViewer/pdf_viewer_main.cpp b/experimental/PdfViewer/pdf_viewer_main.cpp
index 79338425ff..8949e7e20e 100644
--- a/experimental/PdfViewer/pdf_viewer_main.cpp
+++ b/experimental/PdfViewer/pdf_viewer_main.cpp
@@ -179,7 +179,7 @@ static bool render_page(const SkString& outputDir,
// Exercise all pdf codepaths as in normal rendering, but no actual bits are changed.
if (!FLAGS_config.isEmpty() && strcmp(FLAGS_config[0], "nul") == 0) {
SkBitmap bitmap;
- SkAutoTUnref<SkBaseDevice> device(SkNEW_ARGS(SkBitmapDevice, (bitmap)));
+ SkAutoTUnref<SkDevice> device(SkNEW_ARGS(SkDevice, (bitmap)));
SkNulCanvas canvas(device);
renderer.renderPage(page < 0 ? 0 : page, &canvas, rect);
} else {
@@ -197,9 +197,9 @@ static bool render_page(const SkString& outputDir,
#else
setup_bitmap(&bitmap, (int)SkScalarToDouble(width), (int)SkScalarToDouble(height));
#endif
- SkAutoTUnref<SkBaseDevice> device;
+ SkAutoTUnref<SkDevice> device;
if (strcmp(FLAGS_config[0], "8888") == 0) {
- device.reset(SkNEW_ARGS(SkBitmapDevice, (bitmap)));
+ device.reset(SkNEW_ARGS(SkDevice, (bitmap)));
}
#if SK_SUPPORT_GPU
else if (strcmp(FLAGS_config[0], "gpu") == 0) {
diff --git a/experimental/SkiaExamples/SkExample.cpp b/experimental/SkiaExamples/SkExample.cpp
index d3601e1cac..387276ad1b 100644
--- a/experimental/SkiaExamples/SkExample.cpp
+++ b/experimental/SkiaExamples/SkExample.cpp
@@ -115,7 +115,7 @@ void SkExampleWindow::setupRenderTarget() {
SkCanvas* SkExampleWindow::createCanvas() {
if (fType == kGPU_DeviceType) {
if (NULL != fContext && NULL != fRenderTarget) {
- SkAutoTUnref<SkBaseDevice> device(new SkGpuDevice(fContext, fRenderTarget));
+ SkAutoTUnref<SkDevice> device(new SkGpuDevice(fContext, fRenderTarget));
return new SkCanvas(device);
}
tearDownBackend();
diff --git a/experimental/iOSSampleApp/SkSampleUIView.mm b/experimental/iOSSampleApp/SkSampleUIView.mm
index 421dfcf275..9fc95bd152 100644
--- a/experimental/iOSSampleApp/SkSampleUIView.mm
+++ b/experimental/iOSSampleApp/SkSampleUIView.mm
@@ -136,8 +136,8 @@ public:
case SampleWindow::kGPU_DeviceType:
case SampleWindow::kNullGPU_DeviceType:
if (fCurContext) {
- SkAutoTUnref<SkBaseDevice> device(new SkGpuDevice(fCurContext,
- fCurRenderTarget));
+ SkAutoTUnref<SkDevice> device(new SkGpuDevice(fCurContext,
+ fCurRenderTarget));
return new SkCanvas(device);
} else {
return NULL;
diff --git a/gm/bitmapcopy.cpp b/gm/bitmapcopy.cpp
index 5e88cfdd0f..1c56bdee8f 100644
--- a/gm/bitmapcopy.cpp
+++ b/gm/bitmapcopy.cpp
@@ -66,7 +66,7 @@ protected:
SkScalar horizMargin(SkIntToScalar(10));
SkScalar vertMargin(SkIntToScalar(10));
- SkBitmapDevice devTmp(SkBitmap::kARGB_8888_Config, 40, 40, false);
+ SkDevice devTmp(SkBitmap::kARGB_8888_Config, 40, 40);
SkCanvas canvasTmp(&devTmp);
draw_checks(&canvasTmp, 40, 40);
diff --git a/gm/deviceproperties.cpp b/gm/deviceproperties.cpp
index 8bca4b7f21..5739b57ca7 100644
--- a/gm/deviceproperties.cpp
+++ b/gm/deviceproperties.cpp
@@ -44,7 +44,7 @@ protected:
SkDeviceProperties::Geometry::Make(SkDeviceProperties::Geometry::kVertical_Orientation,
SkDeviceProperties::Geometry::kBGR_Layout),
SK_Scalar1);
- SkBitmapDevice device(bitmap, properties);
+ SkDevice device(bitmap, properties);
SkCanvas canvas(&device);
canvas.drawColor(SK_ColorWHITE);
diff --git a/gm/displacement.cpp b/gm/displacement.cpp
index 503172011c..888051dffc 100644
--- a/gm/displacement.cpp
+++ b/gm/displacement.cpp
@@ -25,7 +25,7 @@ protected:
void make_bitmap() {
fBitmap.setConfig(SkBitmap::kARGB_8888_Config, 80, 80);
fBitmap.allocPixels();
- SkBitmapDevice device(fBitmap);
+ SkDevice device(fBitmap);
SkCanvas canvas(&device);
canvas.clear(0x00000000);
SkPaint paint;
@@ -39,7 +39,7 @@ protected:
void make_checkerboard() {
fCheckerboard.setConfig(SkBitmap::kARGB_8888_Config, 80, 80);
fCheckerboard.allocPixels();
- SkBitmapDevice device(fCheckerboard);
+ SkDevice device(fCheckerboard);
SkCanvas canvas(&device);
canvas.clear(0x00000000);
SkPaint darkPaint;
diff --git a/gm/extractbitmap.cpp b/gm/extractbitmap.cpp
index 520674176d..59f8a93cb7 100644
--- a/gm/extractbitmap.cpp
+++ b/gm/extractbitmap.cpp
@@ -74,7 +74,7 @@ protected:
}
// Now do the same but with a device bitmap as source image
- SkAutoTUnref<SkBaseDevice> secondDevice(canvas->createCompatibleDevice(
+ SkAutoTUnref<SkDevice> secondDevice(canvas->createCompatibleDevice(
SkBitmap::kARGB_8888_Config, bitmap.width(),
bitmap.height(), true));
SkCanvas secondCanvas(secondDevice.get());
diff --git a/gm/gmmain.cpp b/gm/gmmain.cpp
index 09dd96eb03..773e1e769c 100644
--- a/gm/gmmain.cpp
+++ b/gm/gmmain.cpp
@@ -517,7 +517,7 @@ public:
SkAutoTUnref<SkCanvas> canvas;
if (gRec.fBackend == kRaster_Backend) {
- SkAutoTUnref<SkBaseDevice> device(SkNEW_ARGS(SkBitmapDevice, (*bitmap)));
+ SkAutoTUnref<SkDevice> device(SkNEW_ARGS(SkDevice, (*bitmap)));
if (deferred) {
canvas.reset(SkDeferredCanvas::Create(device));
} else {
@@ -528,7 +528,7 @@ public:
}
#if SK_SUPPORT_GPU
else { // GPU
- SkAutoTUnref<SkBaseDevice> device(SkGpuDevice::Create(gpuTarget));
+ SkAutoTUnref<SkDevice> device(SkGpuDevice::Create(gpuTarget));
if (deferred) {
canvas.reset(SkDeferredCanvas::Create(device));
} else {
diff --git a/gm/imagefiltersgraph.cpp b/gm/imagefiltersgraph.cpp
index 363a4147e9..38df075bd8 100644
--- a/gm/imagefiltersgraph.cpp
+++ b/gm/imagefiltersgraph.cpp
@@ -32,7 +32,7 @@ protected:
void make_bitmap() {
fBitmap.setConfig(SkBitmap::kARGB_8888_Config, 100, 100);
fBitmap.allocPixels();
- SkBitmapDevice device(fBitmap);
+ SkDevice device(fBitmap);
SkCanvas canvas(&device);
canvas.clear(0x00000000);
SkPaint paint;
diff --git a/gm/lighting.cpp b/gm/lighting.cpp
index a89a7f11b9..f16e781db0 100644
--- a/gm/lighting.cpp
+++ b/gm/lighting.cpp
@@ -27,7 +27,7 @@ protected:
void make_bitmap() {
fBitmap.setConfig(SkBitmap::kARGB_8888_Config, 100, 100);
fBitmap.allocPixels();
- SkBitmapDevice device(fBitmap);
+ SkDevice device(fBitmap);
SkCanvas canvas(&device);
canvas.clear(0x00000000);
SkPaint paint;
diff --git a/gm/matrixconvolution.cpp b/gm/matrixconvolution.cpp
index 853b57be07..59bd38008b 100644
--- a/gm/matrixconvolution.cpp
+++ b/gm/matrixconvolution.cpp
@@ -26,7 +26,7 @@ protected:
void make_bitmap() {
fBitmap.setConfig(SkBitmap::kARGB_8888_Config, 80, 80);
fBitmap.allocPixels();
- SkBitmapDevice device(fBitmap);
+ SkDevice device(fBitmap);
SkCanvas canvas(&device);
canvas.clear(0x00000000);
SkPaint paint;
diff --git a/gm/morphology.cpp b/gm/morphology.cpp
index 2d29fcd201..83de758a9b 100644
--- a/gm/morphology.cpp
+++ b/gm/morphology.cpp
@@ -28,7 +28,7 @@ protected:
void make_bitmap() {
fBitmap.setConfig(SkBitmap::kARGB_8888_Config, 135, 135);
fBitmap.allocPixels();
- SkBitmapDevice device(fBitmap);
+ SkDevice device(fBitmap);
SkCanvas canvas(&device);
canvas.clear(0x0);
SkPaint paint;
diff --git a/gm/ninepatchstretch.cpp b/gm/ninepatchstretch.cpp
index 551f020625..c4c52913c0 100644
--- a/gm/ninepatchstretch.cpp
+++ b/gm/ninepatchstretch.cpp
@@ -14,7 +14,7 @@ class GrContext;
#endif
static void make_bitmap(SkBitmap* bitmap, GrContext* ctx, SkIRect* center) {
- SkBaseDevice* dev;
+ SkDevice* dev;
const int kFixed = 28;
const int kStretchy = 8;
@@ -29,7 +29,7 @@ static void make_bitmap(SkBitmap* bitmap, GrContext* ctx, SkIRect* center) {
{
bitmap->setConfig(SkBitmap::kARGB_8888_Config, kSize, kSize);
bitmap->allocPixels();
- dev = new SkBitmapDevice(*bitmap);
+ dev = new SkDevice(*bitmap);
}
SkCanvas canvas(dev);
diff --git a/gm/srcmode.cpp b/gm/srcmode.cpp
index e8a97e2b7b..66729e2737 100644
--- a/gm/srcmode.cpp
+++ b/gm/srcmode.cpp
@@ -124,7 +124,7 @@ protected:
SkImage::kPremul_AlphaType
};
#if SK_SUPPORT_GPU
- SkBaseDevice* dev = canvas->getDevice();
+ SkDevice* dev = canvas->getDevice();
if (!skipGPU && dev->accessRenderTarget()) {
SkGpuDevice* gd = (SkGpuDevice*)dev;
GrContext* ctx = gd->context();
diff --git a/gm/texdata.cpp b/gm/texdata.cpp
index 0e2d7fdeae..612cc64951 100644
--- a/gm/texdata.cpp
+++ b/gm/texdata.cpp
@@ -38,7 +38,7 @@ protected:
}
virtual void onDraw(SkCanvas* canvas) {
- SkBaseDevice* device = canvas->getTopDevice();
+ SkDevice* device = canvas->getTopDevice();
GrRenderTarget* target = device->accessRenderTarget();
GrContext* ctx = GetGr();
if (ctx && target) {
diff --git a/gm/xfermodeimagefilter.cpp b/gm/xfermodeimagefilter.cpp
index 94d60e45eb..86225af92d 100644
--- a/gm/xfermodeimagefilter.cpp
+++ b/gm/xfermodeimagefilter.cpp
@@ -31,7 +31,7 @@ protected:
void make_bitmap() {
fBitmap.setConfig(SkBitmap::kARGB_8888_Config, 80, 80);
fBitmap.allocPixels();
- SkBitmapDevice device(fBitmap);
+ SkDevice device(fBitmap);
SkCanvas canvas(&device);
canvas.clear(0x00000000);
SkPaint paint;
@@ -45,7 +45,7 @@ protected:
void make_checkerboard() {
fCheckerboard.setConfig(SkBitmap::kARGB_8888_Config, 80, 80);
fCheckerboard.allocPixels();
- SkBitmapDevice device(fCheckerboard);
+ SkDevice device(fCheckerboard);
SkCanvas canvas(&device);
canvas.clear(0x00000000);
SkPaint darkPaint;
diff --git a/gm/xfermodes3.cpp b/gm/xfermodes3.cpp
index baac3cdaff..f1eff1f369 100644
--- a/gm/xfermodes3.cpp
+++ b/gm/xfermodes3.cpp
@@ -132,7 +132,7 @@ private:
desc.fConfig = rt->config();
desc.fFlags = kRenderTarget_GrTextureFlagBit;
SkAutoTUnref<GrSurface> surface(context->createUncachedTexture(desc, NULL, 0));
- SkAutoTUnref<SkBaseDevice> device(SkGpuDevice::Create(surface.get()));
+ SkAutoTUnref<SkDevice> device(SkGpuDevice::Create(surface.get()));
if (NULL != device.get()) {
tempCanvas = SkNEW_ARGS(SkCanvas, (device.get()));
}
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index cfc252fccf..827ebe866d 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -22,7 +22,7 @@
#include "SkXfermode.h"
class SkBounder;
-class SkBaseDevice;
+class SkDevice;
class SkDraw;
class SkDrawFilter;
class SkMetaData;
@@ -55,7 +55,7 @@ public:
@param device Specifies a device for the canvas to draw into.
*/
- explicit SkCanvas(SkBaseDevice* device);
+ explicit SkCanvas(SkDevice* device);
/** Deprecated - Construct a canvas with the specified bitmap to draw into.
@param bitmap Specifies a bitmap for the canvas to draw into. Its
@@ -84,7 +84,7 @@ public:
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;
+ SkDevice* getDevice() const;
/**
* saveLayer() can create another device (which is later drawn onto
@@ -99,15 +99,15 @@ public:
* is drawn to, but is optional here, as there is a small perf hit
* sometimes.
*/
- SkBaseDevice* getTopDevice(bool updateMatrixClip = false) const;
+ SkDevice* getTopDevice(bool updateMatrixClip = false) const;
/**
* Shortcut for getDevice()->createCompatibleDevice(...).
* If getDevice() == NULL, this method does nothing, and returns NULL.
*/
- SkBaseDevice* createCompatibleDevice(SkBitmap::Config config,
- int width, int height,
- bool isOpaque);
+ SkDevice* createCompatibleDevice(SkBitmap::Config config,
+ int width, int height,
+ bool isOpaque);
///////////////////////////////////////////////////////////////////////////
@@ -994,7 +994,7 @@ public:
// These reflect the current device in the iterator
- SkBaseDevice* device() const;
+ SkDevice* device() const;
const SkMatrix& matrix() const;
const SkRegion& clip() const;
const SkPaint& paint() const;
@@ -1043,7 +1043,7 @@ protected:
reference count is incremented. If the canvas was already holding a
device, its reference count is decremented. The new device is returned.
*/
- virtual SkBaseDevice* setDevice(SkBaseDevice* device);
+ virtual SkDevice* setDevice(SkDevice* device);
private:
class MCRec;
@@ -1074,10 +1074,10 @@ private:
friend class SkDrawIter; // needs setupDrawForLayerDevice()
friend class AutoDrawLooper;
- SkBaseDevice* createLayerDevice(SkBitmap::Config, int width, int height,
- bool isOpaque);
+ SkDevice* createLayerDevice(SkBitmap::Config, int width, int height,
+ bool isOpaque);
- SkBaseDevice* init(SkBaseDevice*);
+ SkDevice* init(SkDevice*);
// internal methods are not virtual, so they can safely be called by other
// canvas apis, without confusing subclasses (like SkPictureRecording)
@@ -1090,7 +1090,7 @@ private:
void internalDrawPaint(const SkPaint& paint);
int internalSaveLayer(const SkRect* bounds, const SkPaint* paint,
SaveFlags, bool justForImageFilter);
- void internalDrawDevice(SkBaseDevice*, int x, int y, const SkPaint*);
+ void internalDrawDevice(SkDevice*, int x, int y, const SkPaint*);
// shared by save() and saveLayer()
int internalSave(SaveFlags flags);
diff --git a/include/core/SkDevice.h b/include/core/SkDevice.h
index 39fad6c274..47eebe27e8 100644
--- a/include/core/SkDevice.h
+++ b/include/core/SkDevice.h
@@ -25,21 +25,57 @@ class SkRegion;
class GrRenderTarget;
-class SK_API SkBaseDevice : public SkRefCnt {
+class SK_API SkDevice : public SkRefCnt {
public:
- SK_DECLARE_INST_COUNT(SkBaseDevice)
+ SK_DECLARE_INST_COUNT(SkDevice)
/**
- * Construct a new device.
+ * Construct a new device with the specified bitmap as its backend. It is
+ * valid for the bitmap to have no pixels associated with it. In that case,
+ * any drawing to this device will have no effect.
*/
- SkBaseDevice();
+ SkDevice(const SkBitmap& bitmap);
/**
- * Construct a new device.
+ * Construct a new device with the specified bitmap as its backend. It is
+ * valid for the bitmap to have no pixels associated with it. In that case,
+ * any drawing to this device will have no effect.
*/
- SkBaseDevice(const SkDeviceProperties& deviceProperties);
+ SkDevice(const SkBitmap& bitmap, const SkDeviceProperties& deviceProperties);
+
+ /**
+ * Create a new raster device and have the pixels be automatically
+ * allocated. The rowBytes of the device will be computed automatically
+ * based on the config and the width.
+ *
+ * @param config The desired config for the pixels. If the request cannot
+ * be met, the closest matching support config will be used.
+ * @param width width (in pixels) of the device
+ * @param height height (in pixels) of the device
+ * @param isOpaque Set to true if it is known that all of the pixels will
+ * be drawn to opaquely. Used as an accelerator when drawing
+ * these pixels to another device.
+ */
+ SkDevice(SkBitmap::Config config, int width, int height, bool isOpaque = false);
+
+ /**
+ * Create a new raster device and have the pixels be automatically
+ * allocated. The rowBytes of the device will be computed automatically
+ * based on the config and the width.
+ *
+ * @param config The desired config for the pixels. If the request cannot
+ * be met, the closest matching support config will be used.
+ * @param width width (in pixels) of the device
+ * @param height height (in pixels) of the device
+ * @param isOpaque Set to true if it is known that all of the pixels will
+ * be drawn to opaquely. Used as an accelerator when drawing
+ * these pixels to another device.
+ * @param deviceProperties Properties which affect compositing.
+ */
+ SkDevice(SkBitmap::Config config, int width, int height, bool isOpaque,
+ const SkDeviceProperties& deviceProperties);
- virtual ~SkBaseDevice();
+ virtual ~SkDevice();
/**
* Creates a device that is of the same type as this device (e.g. SW-raster,
@@ -52,9 +88,9 @@ public:
* draw into this device such that all of the pixels will
* be opaque.
*/
- SkBaseDevice* createCompatibleDevice(SkBitmap::Config config,
- int width, int height,
- bool isOpaque);
+ SkDevice* createCompatibleDevice(SkBitmap::Config config,
+ int width, int height,
+ bool isOpaque);
SkMetaData& getMetaData();
@@ -63,14 +99,14 @@ public:
kVector_Capability = 0x2, //!< mask indicating a vector representation
kAll_Capabilities = 0x3
};
- virtual uint32_t getDeviceCapabilities() = 0;
+ virtual uint32_t getDeviceCapabilities() { return 0; }
/** Return the width of the device (in pixels).
*/
- virtual int width() const = 0;
+ virtual int width() const { return fBitmap.width(); }
/** Return the height of the device (in pixels).
*/
- virtual int height() const = 0;
+ virtual int height() const { return fBitmap.height(); }
/** Return the image properties of the device. */
virtual const SkDeviceProperties& getDeviceProperties() const {
@@ -83,12 +119,16 @@ public:
* 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.
*/
- virtual void getGlobalBounds(SkIRect* bounds) const = 0;
+ void getGlobalBounds(SkIRect* bounds) const;
/** Returns true if the device's bitmap's config treats every pixels as
implicitly opaque.
*/
- virtual bool isOpaque() const = 0;
+ bool isOpaque() const { return fBitmap.isOpaque(); }
+
+ /** Return the bitmap config of the device's pixels
+ */
+ SkBitmap::Config config() const { return fBitmap.getConfig(); }
/** Return the bitmap associated with this device. Call this each time you need
to access the bitmap, as it notifies the subclass to perform any flushing
@@ -114,12 +154,12 @@ public:
* not kARGB_8888_Config then this parameter is ignored.
*/
virtual void writePixels(const SkBitmap& bitmap, int x, int y,
- SkCanvas::Config8888 config8888 = SkCanvas::kNative_Premul_Config8888) = 0;
+ SkCanvas::Config8888 config8888 = SkCanvas::kNative_Premul_Config8888);
/**
* Return the device's associated gpu render target, or NULL.
*/
- virtual GrRenderTarget* accessRenderTarget() = 0;
+ virtual GrRenderTarget* accessRenderTarget() { return NULL; }
/**
@@ -131,7 +171,7 @@ public:
/**
* onAttachToCanvas is invoked whenever a device is installed in a canvas
* (i.e., setDevice, saveLayer (for the new device created by the save),
- * and SkCanvas' SkBaseDevice & SkBitmap -taking ctors). It allows the
+ * and SkCanvas' SkDevice & SkBitmap -taking ctors). It allows the
* devices to prepare for drawing (e.g., locking their pixels, etc.)
*/
virtual void onAttachToCanvas(SkCanvas*) {
@@ -173,9 +213,9 @@ protected:
* textflags parameter (output) and return true. If the paint is fine as
* is, then ignore the textflags parameter and return false.
*
- * The baseclass SkBaseDevice filters based on its depth and blitters.
+ * The baseclass SkDevice filters based on its depth and blitters.
*/
- virtual bool filterTextFlags(const SkPaint& paint, TextFlags*) = 0;
+ virtual bool filterTextFlags(const SkPaint& paint, TextFlags*);
/**
*
@@ -194,12 +234,12 @@ protected:
* passed in).
*/
virtual void setMatrixClip(const SkMatrix&, const SkRegion&,
- const SkClipStack&) {};
+ const SkClipStack&);
/** Clears the entire device to the specified color (including alpha).
* Ignores the clip.
*/
- virtual void clear(SkColor color) = 0;
+ virtual void clear(SkColor color);
/**
* Deprecated name for clear.
@@ -211,15 +251,15 @@ protected:
and are handling any looping from the paint, and any effects from the
DrawFilter.
*/
- virtual void drawPaint(const SkDraw&, const SkPaint& paint) = 0;
+ virtual void drawPaint(const SkDraw&, const SkPaint& paint);
virtual void drawPoints(const SkDraw&, SkCanvas::PointMode mode, size_t count,
- const SkPoint[], const SkPaint& paint) = 0;
+ const SkPoint[], const SkPaint& paint);
virtual void drawRect(const SkDraw&, const SkRect& r,
- const SkPaint& paint) = 0;
+ const SkPaint& paint);
virtual void drawOval(const SkDraw&, const SkRect& oval,
- const SkPaint& paint) = 0;
+ const SkPaint& paint);
virtual void drawRRect(const SkDraw&, const SkRRect& rr,
- const SkPaint& paint) = 0;
+ const SkPaint& paint);
/**
* If pathIsMutable, then the implementation is allowed to cast path to a
@@ -235,11 +275,11 @@ protected:
virtual void drawPath(const SkDraw&, const SkPath& path,
const SkPaint& paint,
const SkMatrix* prePathMatrix = NULL,
- bool pathIsMutable = false) = 0;
+ bool pathIsMutable = false);
virtual void drawBitmap(const SkDraw&, const SkBitmap& bitmap,
- const SkMatrix& matrix, const SkPaint& paint) = 0;
+ const SkMatrix& matrix, const SkPaint& paint);
virtual void drawSprite(const SkDraw&, const SkBitmap& bitmap,
- int x, int y, const SkPaint& paint) = 0;
+ int x, int y, const SkPaint& paint);
/**
* The default impl. will create a bitmap-shader from the bitmap,
@@ -248,35 +288,35 @@ protected:
virtual void drawBitmapRect(const SkDraw&, const SkBitmap&,
const SkRect* srcOrNull, const SkRect& dst,
const SkPaint& paint,
- SkCanvas::DrawBitmapRectFlags flags) = 0;
+ SkCanvas::DrawBitmapRectFlags flags);
/**
* Does not handle text decoration.
* Decorations (underline and stike-thru) will be handled by SkCanvas.
*/
virtual void drawText(const SkDraw&, const void* text, size_t len,
- SkScalar x, SkScalar y, const SkPaint& paint) = 0;
+ SkScalar x, SkScalar y, const SkPaint& paint);
virtual void drawPosText(const SkDraw&, const void* text, size_t len,
const SkScalar pos[], SkScalar constY,
- int scalarsPerPos, const SkPaint& paint) = 0;
+ int scalarsPerPos, const SkPaint& paint);
virtual void drawTextOnPath(const SkDraw&, const void* text, size_t len,
const SkPath& path, const SkMatrix* matrix,
- const SkPaint& paint) = 0;
+ const SkPaint& paint);
#ifdef SK_BUILD_FOR_ANDROID
virtual void drawPosTextOnPath(const SkDraw& draw, const void* text, size_t len,
const SkPoint pos[], const SkPaint& paint,
- const SkPath& path, const SkMatrix* matrix) = 0;
+ const SkPath& path, const SkMatrix* matrix);
#endif
virtual void drawVertices(const SkDraw&, SkCanvas::VertexMode, int vertexCount,
const SkPoint verts[], const SkPoint texs[],
const SkColor colors[], SkXfermode* xmode,
const uint16_t indices[], int indexCount,
- const SkPaint& paint) = 0;
- /** The SkBaseDevice passed will be an SkBaseDevice which was returned by a call to
+ const SkPaint& paint);
+ /** The SkDevice passed will be an SkDevice which was returned by a call to
onCreateCompatibleDevice on this device with kSaveLayer_Usage.
*/
- virtual void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y,
- const SkPaint&) = 0;
+ virtual void drawDevice(const SkDraw&, SkDevice*, int x, int y,
+ const SkPaint&);
/**
* On success (returns true), copy the device pixels into the bitmap.
@@ -312,10 +352,20 @@ protected:
///////////////////////////////////////////////////////////////////////////
/** Update as needed the pixel value in the bitmap, so that the caller can
- access the pixels directly.
- @return The device contents as a bitmap
+ access the pixels directly. Note: only the pixels field should be
+ altered. The config/width/height/rowbytes must remain unchanged.
+ @param bitmap The device's bitmap
+ @return Echo the bitmap parameter, or an alternate (shadow) bitmap
+ maintained by the subclass.
*/
- virtual const SkBitmap& onAccessBitmap() = 0;
+ virtual const SkBitmap& onAccessBitmap(SkBitmap*);
+
+ SkPixelRef* getPixelRef() const { return fBitmap.pixelRef(); }
+ // just for subclasses, to assign a custom pixelref
+ SkPixelRef* setPixelRef(SkPixelRef* pr, size_t offset) {
+ fBitmap.setPixelRef(pr, offset);
+ return pr;
+ }
/**
* Implements readPixels API. The caller will ensure that:
@@ -326,13 +376,13 @@ protected:
*/
virtual bool onReadPixels(const SkBitmap& bitmap,
int x, int y,
- SkCanvas::Config8888 config8888) = 0;
+ SkCanvas::Config8888 config8888);
/** Called when this device is installed into a Canvas. Balanaced by a call
to unlockPixels() when the device is removed from a Canvas.
*/
- virtual void lockPixels() = 0;
- virtual void unlockPixels() = 0;
+ virtual void lockPixels();
+ virtual void unlockPixels();
/**
* Returns true if the device allows processing of this imagefilter. If
@@ -340,7 +390,7 @@ protected:
* some subclasses that do not support pixel manipulations after drawing
* has occurred (e.g. printing). The default implementation returns true.
*/
- virtual bool allowImageFilter(SkImageFilter*) = 0;
+ virtual bool allowImageFilter(SkImageFilter*);
/**
* Override and return true for filters that the device can handle
@@ -349,7 +399,7 @@ protected:
* Returning false means the SkCanvas will have apply the filter itself,
* and just pass the resulting image to the device.
*/
- virtual bool canHandleImageFilter(SkImageFilter*) = 0;
+ virtual bool canHandleImageFilter(SkImageFilter*);
/**
* Related (but not required) to canHandleImageFilter, this method returns
@@ -359,7 +409,7 @@ protected:
* it just returns false and leaves result and offset unchanged.
*/
virtual bool filterImage(SkImageFilter*, const SkBitmap&, const SkMatrix&,
- SkBitmap* result, SkIPoint* offset) = 0;
+ SkBitmap* result, SkIPoint* offset);
// This is equal kBGRA_Premul_Config8888 or kRGBA_Premul_Config8888 if
// either is identical to kNative_Premul_Config8888. Otherwise, -1.
@@ -374,31 +424,31 @@ private:
friend class SkDeviceImageFilterProxy;
friend class SkSurface_Raster;
-
// used to change the backend's pixels (and possibly config/rowbytes)
// but cannot change the width/height, so there should be no change to
// any clip information.
- virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) = 0;
+ void replaceBitmapBackendForRasterSurface(const SkBitmap&);
// just called by SkCanvas when built as a layer
void setOrigin(int x, int y) { fOrigin.set(x, y); }
// just called by SkCanvas for saveLayer
- SkBaseDevice* createCompatibleDeviceForSaveLayer(SkBitmap::Config config,
- int width, int height,
- bool isOpaque);
+ SkDevice* createCompatibleDeviceForSaveLayer(SkBitmap::Config config,
+ int width, int height,
+ bool isOpaque);
/**
* Subclasses should override this to implement createCompatibleDevice.
*/
- virtual SkBaseDevice* onCreateCompatibleDevice(SkBitmap::Config config,
- int width, int height,
- bool isOpaque,
- Usage usage) = 0;
+ virtual SkDevice* onCreateCompatibleDevice(SkBitmap::Config config,
+ int width, int height,
+ bool isOpaque,
+ Usage usage);
/** Causes any deferred drawing to the device to be completed.
*/
- virtual void flush() = 0;
+ virtual void flush() {}
+ SkBitmap fBitmap;
SkIPoint fOrigin;
SkMetaData* fMetaData;
/**
@@ -416,289 +466,4 @@ private:
typedef SkRefCnt INHERITED;
};
-///////////////////////////////////////////////////////////////////////////////
-class SK_API SkBitmapDevice : public SkBaseDevice {
-public:
- SK_DECLARE_INST_COUNT(SkBitmapDevice)
-
- /**
- * Construct a new device with the specified bitmap as its backend. It is
- * valid for the bitmap to have no pixels associated with it. In that case,
- * any drawing to this device will have no effect.
- */
- SkBitmapDevice(const SkBitmap& bitmap);
-
- /**
- * Construct a new device with the specified bitmap as its backend. It is
- * valid for the bitmap to have no pixels associated with it. In that case,
- * any drawing to this device will have no effect.
- */
- SkBitmapDevice(const SkBitmap& bitmap, const SkDeviceProperties& deviceProperties);
-
- /**
- * Create a new raster device and have the pixels be automatically
- * allocated. The rowBytes of the device will be computed automatically
- * based on the config and the width.
- *
- * @param config The desired config for the pixels. If the request cannot
- * be met, the closest matching support config will be used.
- * @param width width (in pixels) of the device
- * @param height height (in pixels) of the device
- * @param isOpaque Set to true if it is known that all of the pixels will
- * be drawn to opaquely. Used as an accelerator when drawing
- * these pixels to another device.
- */
- SkBitmapDevice(SkBitmap::Config config, int width, int height, bool isOpaque);
-
- /**
- * Create a new raster device and have the pixels be automatically
- * allocated. The rowBytes of the device will be computed automatically
- * based on the config and the width.
- *
- * @param config The desired config for the pixels. If the request cannot
- * be met, the closest matching support config will be used.
- * @param width width (in pixels) of the device
- * @param height height (in pixels) of the device
- * @param isOpaque Set to true if it is known that all of the pixels will
- * be drawn to opaquely. Used as an accelerator when drawing
- * these pixels to another device.
- * @param deviceProperties Properties which affect compositing.
- */
- SkBitmapDevice(SkBitmap::Config config, int width, int height, bool isOpaque,
- const SkDeviceProperties& deviceProperties);
-
- virtual ~SkBitmapDevice();
-
- virtual uint32_t getDeviceCapabilities() SK_OVERRIDE { return 0; }
-
- /** Return the width of the device (in pixels).
- */
- virtual int width() const SK_OVERRIDE { return fBitmap.width(); }
- /** Return the height of the device (in pixels).
- */
- virtual int height() const SK_OVERRIDE { return fBitmap.height(); }
-
- /**
- * 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.
- */
- virtual void getGlobalBounds(SkIRect* bounds) const SK_OVERRIDE;
-
- /** Returns true if the device's bitmap's config treats every pixels as
- implicitly opaque.
- */
- virtual bool isOpaque() const SK_OVERRIDE { return fBitmap.isOpaque(); }
-
- /** Return the bitmap config of the device's pixels
- */
- virtual SkBitmap::Config config() const { return fBitmap.getConfig(); }
-
- /**
- * DEPRECATED: This will be made protected once WebKit stops using it.
- * Instead use Canvas' writePixels method.
- *
- * Similar to draw sprite, this method will copy the pixels in bitmap onto
- * the device, with the top/left corner specified by (x, y). The pixel
- * values in the device are completely replaced: there is no blending.
- *
- * Currently if bitmap is backed by a texture this is a no-op. This may be
- * relaxed in the future.
- *
- * If the bitmap has config kARGB_8888_Config then the config8888 param
- * will determines how the pixel valuess are intepreted. If the bitmap is
- * not kARGB_8888_Config then this parameter is ignored.
- */
- virtual void writePixels(const SkBitmap& bitmap, int x, int y,
- SkCanvas::Config8888 config8888) SK_OVERRIDE;
-
- /**
- * Return the device's associated gpu render target, or NULL.
- */
- virtual GrRenderTarget* accessRenderTarget() SK_OVERRIDE { return NULL; }
-
-protected:
- /**
- * Device may filter the text flags for drawing text here. If it wants to
- * make a change to the specified values, it should write them into the
- * textflags parameter (output) and return true. If the paint is fine as
- * is, then ignore the textflags parameter and return false.
- *
- * The baseclass SkDevice filters based on its depth and blitters.
- */
- virtual bool filterTextFlags(const SkPaint& paint, TextFlags*) SK_OVERRIDE;
-
- /** Clears the entire device to the specified color (including alpha).
- * Ignores the clip.
- */
- virtual void clear(SkColor color) SK_OVERRIDE;
-
- /** These are called inside the per-device-layer loop for each draw call.
- When these are called, we have already applied any saveLayer operations,
- and are handling any looping from the paint, and any effects from the
- DrawFilter.
- */
- virtual void drawPaint(const SkDraw&, const SkPaint& paint) SK_OVERRIDE;
- virtual void drawPoints(const SkDraw&, SkCanvas::PointMode mode, size_t count,
- const SkPoint[], const SkPaint& paint) SK_OVERRIDE;
- virtual void drawRect(const SkDraw&, const SkRect& r,
- const SkPaint& paint) SK_OVERRIDE;
- virtual void drawOval(const SkDraw&, const SkRect& oval,
- const SkPaint& paint) SK_OVERRIDE;
- virtual void drawRRect(const SkDraw&, const SkRRect& rr,
- const SkPaint& paint) SK_OVERRIDE;
-
- /**
- * If pathIsMutable, then the implementation is allowed to cast path to a
- * non-const pointer and modify it in place (as an optimization). Canvas
- * may do this to implement helpers such as drawOval, by placing a temp
- * path on the stack to hold the representation of the oval.
- *
- * If prePathMatrix is not null, it should logically be applied before any
- * stroking or other effects. If there are no effects on the paint that
- * affect the geometry/rasterization, then the pre matrix can just be
- * pre-concated with the current matrix.
- */
- virtual void drawPath(const SkDraw&, const SkPath& path,
- const SkPaint& paint,
- const SkMatrix* prePathMatrix = NULL,
- bool pathIsMutable = false) SK_OVERRIDE;
- virtual void drawBitmap(const SkDraw&, const SkBitmap& bitmap,
- const SkMatrix& matrix, const SkPaint& paint) SK_OVERRIDE;
- virtual void drawSprite(const SkDraw&, const SkBitmap& bitmap,
- int x, int y, const SkPaint& paint) SK_OVERRIDE;
-
- /**
- * The default impl. will create a bitmap-shader from the bitmap,
- * and call drawRect with it.
- */
- virtual void drawBitmapRect(const SkDraw&, const SkBitmap&,
- const SkRect* srcOrNull, const SkRect& dst,
- const SkPaint& paint,
- SkCanvas::DrawBitmapRectFlags flags) SK_OVERRIDE;
-
- /**
- * Does not handle text decoration.
- * Decorations (underline and stike-thru) will be handled by SkCanvas.
- */
- virtual void drawText(const SkDraw&, const void* text, size_t len,
- SkScalar x, SkScalar y, const SkPaint& paint) SK_OVERRIDE;
- virtual void drawPosText(const SkDraw&, const void* text, size_t len,
- const SkScalar pos[], SkScalar constY,
- int scalarsPerPos, const SkPaint& paint) SK_OVERRIDE;
- virtual void drawTextOnPath(const SkDraw&, const void* text, size_t len,
- const SkPath& path, const SkMatrix* matrix,
- const SkPaint& paint) SK_OVERRIDE;
-#ifdef SK_BUILD_FOR_ANDROID
- virtual void drawPosTextOnPath(const SkDraw& draw, const void* text, size_t len,
- const SkPoint pos[], const SkPaint& paint,
- const SkPath& path, const SkMatrix* matrix) SK_OVERRIDE;
-#endif
- virtual void drawVertices(const SkDraw&, SkCanvas::VertexMode, int vertexCount,
- const SkPoint verts[], const SkPoint texs[],
- const SkColor colors[], SkXfermode* xmode,
- const uint16_t indices[], int indexCount,
- const SkPaint& paint) SK_OVERRIDE;
- /** The SkBaseDevice passed will be an SkBaseDevice which was returned by a call to
- onCreateCompatibleDevice on this device with kSaveLayer_Usage.
- */
- virtual void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y,
- const SkPaint&) SK_OVERRIDE;
-
- ///////////////////////////////////////////////////////////////////////////
-
- /** Update as needed the pixel value in the bitmap, so that the caller can
- access the pixels directly. Note: only the pixels field should be
- altered. The config/width/height/rowbytes must remain unchanged.
- @return the device contents as a bitmap
- */
- virtual const SkBitmap& onAccessBitmap() SK_OVERRIDE;
-
- SkPixelRef* getPixelRef() const { return fBitmap.pixelRef(); }
- // just for subclasses, to assign a custom pixelref
- SkPixelRef* setPixelRef(SkPixelRef* pr, size_t offset) {
- fBitmap.setPixelRef(pr, offset);
- return pr;
- }
-
- /**
- * Implements readPixels API. The caller will ensure that:
- * 1. bitmap has pixel config kARGB_8888_Config.
- * 2. bitmap has pixels.
- * 3. The rectangle (x, y, x + bitmap->width(), y + bitmap->height()) is
- * contained in the device bounds.
- */
- virtual bool onReadPixels(const SkBitmap& bitmap,
- int x, int y,
- SkCanvas::Config8888 config8888) SK_OVERRIDE;
-
- /** Called when this device is installed into a Canvas. Balanced by a call
- to unlockPixels() when the device is removed from a Canvas.
- */
- virtual void lockPixels() SK_OVERRIDE;
- virtual void unlockPixels() SK_OVERRIDE;
-
- /**
- * Returns true if the device allows processing of this imagefilter. If
- * false is returned, then the filter is ignored. This may happen for
- * some subclasses that do not support pixel manipulations after drawing
- * has occurred (e.g. printing). The default implementation returns true.
- */
- virtual bool allowImageFilter(SkImageFilter*) SK_OVERRIDE;
-
- /**
- * Override and return true for filters that the device can handle
- * intrinsically. Doing so means that SkCanvas will pass-through this
- * filter to drawSprite and drawDevice (and potentially filterImage).
- * Returning false means the SkCanvas will have apply the filter itself,
- * and just pass the resulting image to the device.
- */
- virtual bool canHandleImageFilter(SkImageFilter*) SK_OVERRIDE;
-
- /**
- * Related (but not required) to canHandleImageFilter, this method returns
- * true if the device could apply the filter to the src bitmap and return
- * the result (and updates offset as needed).
- * If the device does not recognize or support this filter,
- * it just returns false and leaves result and offset unchanged.
- */
- virtual bool filterImage(SkImageFilter*, const SkBitmap&, const SkMatrix&,
- SkBitmap* result, SkIPoint* offset) SK_OVERRIDE;
-
-private:
- friend class SkCanvas;
- friend struct DeviceCM; //for setMatrixClip
- friend class SkDraw;
- friend class SkDrawIter;
- friend class SkDeviceFilteredPaint;
- friend class SkDeviceImageFilterProxy;
-
- friend class SkSurface_Raster;
-
- // used to change the backend's pixels (and possibly config/rowbytes)
- // but cannot change the width/height, so there should be no change to
- // any clip information.
- virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) SK_OVERRIDE;
-
- /**
- * Subclasses should override this to implement createCompatibleDevice.
- */
- virtual SkBaseDevice* onCreateCompatibleDevice(SkBitmap::Config config,
- int width, int height,
- bool isOpaque,
- Usage usage) SK_OVERRIDE;
-
- /** Causes any deferred drawing to the device to be completed.
- */
- virtual void flush() SK_OVERRIDE {}
-
- SkBitmap fBitmap;
-
- typedef SkBaseDevice INHERITED;
-};
-
-// Temporary typedef until Chromium (and other clients) are able to move to
-// SkBaseDevice or SkBitmapDevice
-typedef SkBitmapDevice SkDevice;
-
#endif
diff --git a/include/core/SkDraw.h b/include/core/SkDraw.h
index 1c2c66efb3..8642f0ab79 100644
--- a/include/core/SkDraw.h
+++ b/include/core/SkDraw.h
@@ -17,7 +17,7 @@
class SkBitmap;
class SkBounder;
class SkClipStack;
-class SkBaseDevice;
+class SkDevice;
class SkMatrix;
class SkPath;
class SkRegion;
@@ -127,7 +127,7 @@ public:
const SkRasterClip* fRC; // required
const SkClipStack* fClipStack; // optional
- SkBaseDevice* fDevice; // optional
+ SkDevice* fDevice; // optional
SkBounder* fBounder; // optional
SkDrawProcs* fProcs; // optional
diff --git a/include/core/SkImageFilter.h b/include/core/SkImageFilter.h
index 9dd1f7aeea..01b3e0bca8 100644
--- a/include/core/SkImageFilter.h
+++ b/include/core/SkImageFilter.h
@@ -13,7 +13,7 @@
class SkBitmap;
class SkColorFilter;
-class SkBaseDevice;
+class SkDevice;
class SkMatrix;
struct SkIPoint;
class SkShader;
@@ -35,7 +35,7 @@ public:
public:
virtual ~Proxy() {};
- virtual SkBaseDevice* createDevice(int width, int height) = 0;
+ virtual SkDevice* createDevice(int width, int height) = 0;
// returns true if the proxy can handle this filter natively
virtual bool canHandleImageFilter(SkImageFilter*) = 0;
// returns true if the proxy handled the filter itself. if this returns
diff --git a/include/core/SkRRect.h b/include/core/SkRRect.h
index 32d62856bc..bce896aad1 100644
--- a/include/core/SkRRect.h
+++ b/include/core/SkRRect.h
@@ -25,7 +25,7 @@ class SkPath;
// use growToInclude to fit skp round rects & generate stats (RRs vs. real paths)
// check on # of rectorus's the RRs could handle
// rendering work
-// add entry points (clipRRect, drawRRect) - plumb down to SkBaseDevice
+// add entry points (clipRRect, drawRRect) - plumb down to SkDevice
// update SkPath.addRRect() to take an SkRRect - only use quads
// -- alternatively add addRRectToPath here
// add GM and bench
diff --git a/include/device/xps/SkXPSDevice.h b/include/device/xps/SkXPSDevice.h
index 91307a595e..dab8d1f6a3 100644
--- a/include/device/xps/SkXPSDevice.h
+++ b/include/device/xps/SkXPSDevice.h
@@ -30,7 +30,7 @@
The drawing context for the XPS backend.
*/
-class SkXPSDevice : public SkBitmapDevice {
+class SkXPSDevice : public SkDevice {
public:
SK_API SkXPSDevice();
SK_API virtual ~SkXPSDevice();
@@ -134,7 +134,7 @@ protected:
virtual void drawDevice(
const SkDraw&,
- SkBaseDevice* device,
+ SkDevice* device,
int x, int y,
const SkPaint& paint) SK_OVERRIDE;
@@ -307,17 +307,18 @@ private:
const SkVector& ppuScale,
IXpsOMPath* shadedPath);
- // override from SkBaseDevice
- virtual SkBaseDevice* onCreateCompatibleDevice(SkBitmap::Config config,
- int width, int height,
- bool isOpaque,
- Usage usage) SK_OVERRIDE;
+ // override from SkDevice
+ virtual SkDevice* onCreateCompatibleDevice(
+ SkBitmap::Config config,
+ int width, int height,
+ bool isOpaque,
+ Usage usage) SK_OVERRIDE;
// Disable the default copy and assign implementation.
SkXPSDevice(const SkXPSDevice&);
void operator=(const SkXPSDevice&);
- typedef SkBitmapDevice INHERITED;
+ typedef SkDevice INHERITED;
};
#endif
diff --git a/include/gpu/SkGpuDevice.h b/include/gpu/SkGpuDevice.h
index a24128bd85..40d2554b00 100644
--- a/include/gpu/SkGpuDevice.h
+++ b/include/gpu/SkGpuDevice.h
@@ -22,10 +22,10 @@ struct GrSkDrawProcs;
class GrTextContext;
/**
- * Subclass of SkBitmapDevice, which directs all drawing to the GrGpu owned by the
+ * Subclass of SkDevice, which directs all drawing to the GrGpu owned by the
* canvas.
*/
-class SK_API SkGpuDevice : public SkBitmapDevice {
+class SK_API SkGpuDevice : public SkDevice {
public:
/**
@@ -62,7 +62,7 @@ public:
virtual GrRenderTarget* accessRenderTarget() SK_OVERRIDE;
- // overrides from SkBaseDevice
+ // overrides from SkDevice
virtual void clear(SkColor color) SK_OVERRIDE;
virtual void writePixels(const SkBitmap& bitmap, int x, int y,
@@ -101,11 +101,11 @@ public:
const SkColor colors[], SkXfermode* xmode,
const uint16_t indices[], int indexCount,
const SkPaint&) SK_OVERRIDE;
- virtual void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y,
+ virtual void drawDevice(const SkDraw&, SkDevice*, int x, int y,
const SkPaint&) SK_OVERRIDE;
virtual bool filterTextFlags(const SkPaint&, TextFlags*) SK_OVERRIDE;
- virtual void flush() SK_OVERRIDE;
+ virtual void flush();
virtual void onAttachToCanvas(SkCanvas* canvas) SK_OVERRIDE;
virtual void onDetachFromCanvas() SK_OVERRIDE;
@@ -123,7 +123,7 @@ public:
class SkAutoCachedTexture; // used internally
protected:
- // overrides from SkBaseDevice
+ // overrides from SkDevice
virtual bool onReadPixels(const SkBitmap& bitmap,
int x, int y,
SkCanvas::Config8888 config8888) SK_OVERRIDE;
@@ -145,11 +145,11 @@ private:
// used by createCompatibleDevice
SkGpuDevice(GrContext*, GrTexture* texture, bool needClear);
- // override from SkBaseDevice
- virtual SkBaseDevice* onCreateCompatibleDevice(SkBitmap::Config config,
- int width, int height,
- bool isOpaque,
- Usage usage) SK_OVERRIDE;
+ // override from SkDevice
+ virtual SkDevice* onCreateCompatibleDevice(SkBitmap::Config config,
+ int width, int height,
+ bool isOpaque,
+ Usage usage) SK_OVERRIDE;
SkDrawProcs* initDrawForText(GrTextContext*);
@@ -192,7 +192,7 @@ private:
*/
GrTextContext* getTextContext();
- typedef SkBitmapDevice INHERITED;
+ typedef SkDevice INHERITED;
};
#endif
diff --git a/include/pdf/SkPDFDevice.h b/include/pdf/SkPDFDevice.h
index b38c9a111b..e64b83f375 100644
--- a/include/pdf/SkPDFDevice.h
+++ b/include/pdf/SkPDFDevice.h
@@ -44,7 +44,7 @@ typedef bool (*EncodeToDCTStream)(SkWStream* stream, const SkBitmap& bitmap, con
The drawing context for the PDF backend.
*/
-class SkPDFDevice : public SkBitmapDevice {
+class SkPDFDevice : public SkDevice {
public:
/** Create a PDF drawing context with the given width and height.
* 72 points/in means letter paper is 612x792.
@@ -107,7 +107,7 @@ public:
const SkPoint texs[], const SkColor colors[],
SkXfermode* xmode, const uint16_t indices[],
int indexCount, const SkPaint& paint) SK_OVERRIDE;
- virtual void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y,
+ virtual void drawDevice(const SkDraw&, SkDevice*, int x, int y,
const SkPaint&) SK_OVERRIDE;
virtual void onAttachToCanvas(SkCanvas* canvas) SK_OVERRIDE;
@@ -237,11 +237,11 @@ private:
SkPDFDevice(const SkISize& layerSize, const SkClipStack& existingClipStack,
const SkRegion& existingClipRegion);
- // override from SkBaseDevice
- virtual SkBaseDevice* onCreateCompatibleDevice(SkBitmap::Config config,
- int width, int height,
- bool isOpaque,
- Usage usage) SK_OVERRIDE;
+ // override from SkDevice
+ virtual SkDevice* onCreateCompatibleDevice(SkBitmap::Config config,
+ int width, int height,
+ bool isOpaque,
+ Usage usage) SK_OVERRIDE;
void init();
void cleanUp(bool clearFontUsage);
@@ -310,7 +310,7 @@ private:
void defineNamedDestination(SkData* nameData, const SkPoint& point,
const SkMatrix& matrix);
- typedef SkBitmapDevice INHERITED;
+ typedef SkDevice INHERITED;
};
#endif
diff --git a/include/utils/SkDeferredCanvas.h b/include/utils/SkDeferredCanvas.h
index c0613ed544..539e5d39dc 100644
--- a/include/utils/SkDeferredCanvas.h
+++ b/include/utils/SkDeferredCanvas.h
@@ -33,7 +33,7 @@ public:
*/
static SkDeferredCanvas* Create(SkSurface* surface);
- static SkDeferredCanvas* Create(SkBaseDevice* device);
+ static SkDeferredCanvas* Create(SkDevice* device);
virtual ~SkDeferredCanvas();
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index b3632f840f..53c28e4d74 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -269,7 +269,7 @@ public:
SampleWindow* win) {
#if SK_SUPPORT_GPU
if (IsGpuDeviceType(dType) && NULL != fCurContext) {
- SkAutoTUnref<SkBaseDevice> device(new SkGpuDevice(fCurContext, fCurRenderTarget));
+ SkAutoTUnref<SkDevice> device(new SkGpuDevice(fCurContext, fCurRenderTarget));
return new SkCanvas(device);
} else
#endif
@@ -1429,7 +1429,7 @@ void SampleWindow::afterChildren(SkCanvas* orig) {
if (fRequestGrabImage) {
fRequestGrabImage = false;
- SkBaseDevice* device = orig->getDevice();
+ SkDevice* device = orig->getDevice();
SkBitmap bmp;
if (device->accessBitmap(false).copyTo(&bmp, SkBitmap::kARGB_8888_Config)) {
static int gSampleGrabCounter;
diff --git a/samplecode/SampleApp.h b/samplecode/SampleApp.h
index 9328f15570..61e6c5d526 100644
--- a/samplecode/SampleApp.h
+++ b/samplecode/SampleApp.h
@@ -61,7 +61,7 @@ public:
/**
* SampleApp ports can subclass this manager class if they want to:
* * filter the types of devices supported
- * * customize plugging of SkBaseDevice objects into an SkCanvas
+ * * customize plugging of SkDevice objects into an SkCanvas
* * customize publishing the results of draw to the OS window
* * manage GrContext / GrRenderTarget lifetimes
*/
diff --git a/samplecode/SampleCircle.cpp b/samplecode/SampleCircle.cpp
index 87ca4872e1..f65ba01abc 100644
--- a/samplecode/SampleCircle.cpp
+++ b/samplecode/SampleCircle.cpp
@@ -74,7 +74,7 @@ protected:
}
static void blowup(SkCanvas* canvas, const SkIRect& src, const SkRect& dst) {
- SkBaseDevice* device = canvas->getDevice();
+ SkDevice* device = canvas->getDevice();
const SkBitmap& bm = device->accessBitmap(false);
canvas->drawBitmapRect(bm, &src, dst, NULL);
}
diff --git a/samplecode/SampleTextureDomain.cpp b/samplecode/SampleTextureDomain.cpp
index 5928f3c942..de84c35ea4 100644
--- a/samplecode/SampleTextureDomain.cpp
+++ b/samplecode/SampleTextureDomain.cpp
@@ -61,7 +61,7 @@ protected:
// the constrainted texture domain.
// Note: GPU-backed bitmaps follow a different rendering path
// when copying from one GPU device to another.
- SkAutoTUnref<SkBaseDevice> secondDevice(canvas->createCompatibleDevice(
+ SkAutoTUnref<SkDevice> secondDevice(canvas->createCompatibleDevice(
SkBitmap::kARGB_8888_Config, 5, 5, true));
SkCanvas secondCanvas(secondDevice.get());
diff --git a/src/core/SkBBoxHierarchyRecord.cpp b/src/core/SkBBoxHierarchyRecord.cpp
index 61a82cef3d..9c02468ae1 100644
--- a/src/core/SkBBoxHierarchyRecord.cpp
+++ b/src/core/SkBBoxHierarchyRecord.cpp
@@ -11,7 +11,7 @@
SkBBoxHierarchyRecord::SkBBoxHierarchyRecord(uint32_t recordFlags,
SkBBoxHierarchy* h,
- SkBaseDevice* device)
+ SkDevice* device)
: INHERITED(recordFlags, device) {
fStateTree = SkNEW(SkPictureStateTree);
fBoundingHierarchy = h;
diff --git a/src/core/SkBBoxHierarchyRecord.h b/src/core/SkBBoxHierarchyRecord.h
index 7284ab04ec..27da3c9188 100644
--- a/src/core/SkBBoxHierarchyRecord.h
+++ b/src/core/SkBBoxHierarchyRecord.h
@@ -20,7 +20,7 @@ class SkBBoxHierarchyRecord : public SkBBoxRecord, public SkBBoxHierarchyClient
public:
/** This will take a ref of h */
SkBBoxHierarchyRecord(uint32_t recordFlags, SkBBoxHierarchy* h,
- SkBaseDevice*);
+ SkDevice*);
virtual void handleBBox(const SkRect& bounds) SK_OVERRIDE;
diff --git a/src/core/SkBBoxRecord.h b/src/core/SkBBoxRecord.h
index fa8b282247..7859df1b02 100644
--- a/src/core/SkBBoxRecord.h
+++ b/src/core/SkBBoxRecord.h
@@ -19,7 +19,7 @@
class SkBBoxRecord : public SkPictureRecord {
public:
- SkBBoxRecord(uint32_t recordFlags, SkBaseDevice* device)
+ SkBBoxRecord(uint32_t recordFlags, SkDevice* device)
: INHERITED(recordFlags, device) { }
virtual ~SkBBoxRecord() { }
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index a8a1d99662..c59cd04016 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -129,7 +129,7 @@ void SkCanvas::predrawNotify() {
///////////////////////////////////////////////////////////////////////////////
-/* This is the record we keep for each SkBaseDevice that the user installs.
+/* This is the record we keep for each SkDevice that the user installs.
The clip/matrix/proc are fields that reflect the top of the save/restore
stack. Whenever the canvas changes, it marks a dirty flag, and then before
these are used (assuming we're not on a layer) we rebuild these cache
@@ -138,12 +138,12 @@ void SkCanvas::predrawNotify() {
*/
struct DeviceCM {
DeviceCM* fNext;
- SkBaseDevice* fDevice;
+ SkDevice* fDevice;
SkRasterClip fClip;
const SkMatrix* fMatrix;
SkPaint* fPaint; // may be null (in the future)
- DeviceCM(SkBaseDevice* device, int x, int y, const SkPaint* paint, SkCanvas* canvas)
+ DeviceCM(SkDevice* device, int x, int y, const SkPaint* paint, SkCanvas* canvas)
: fNext(NULL) {
if (NULL != device) {
device->ref();
@@ -315,7 +315,7 @@ public:
return false;
}
- SkBaseDevice* getDevice() const { return fDevice; }
+ SkDevice* getDevice() const { return fDevice; }
int getX() const { return fDevice->getOrigin().x(); }
int getY() const { return fDevice->getOrigin().y(); }
const SkMatrix& getMatrix() const { return *fMatrix; }
@@ -482,7 +482,7 @@ private:
////////////////////////////////////////////////////////////////////////////
-SkBaseDevice* SkCanvas::init(SkBaseDevice* device) {
+SkDevice* SkCanvas::init(SkDevice* device) {
fBounder = NULL;
fLocalBoundsCompareType.setEmpty();
fLocalBoundsCompareTypeDirty = true;
@@ -511,7 +511,7 @@ SkCanvas::SkCanvas()
this->init(NULL);
}
-SkCanvas::SkCanvas(SkBaseDevice* device)
+SkCanvas::SkCanvas(SkDevice* device)
: fMCStack(sizeof(MCRec), fMCRecStorage, sizeof(fMCRecStorage)) {
inc_canvas();
@@ -522,7 +522,7 @@ SkCanvas::SkCanvas(const SkBitmap& bitmap)
: fMCStack(sizeof(MCRec), fMCRecStorage, sizeof(fMCRecStorage)) {
inc_canvas();
- this->init(SkNEW_ARGS(SkBitmapDevice, (bitmap)))->unref();
+ this->init(SkNEW_ARGS(SkDevice, (bitmap)))->unref();
}
SkCanvas::~SkCanvas() {
@@ -564,37 +564,37 @@ SkMetaData& SkCanvas::getMetaData() {
///////////////////////////////////////////////////////////////////////////////
void SkCanvas::flush() {
- SkBaseDevice* device = this->getDevice();
+ SkDevice* device = this->getDevice();
if (device) {
device->flush();
}
}
SkISize SkCanvas::getDeviceSize() const {
- SkBaseDevice* d = this->getDevice();
+ SkDevice* d = this->getDevice();
return d ? SkISize::Make(d->width(), d->height()) : SkISize::Make(0, 0);
}
-SkBaseDevice* SkCanvas::getDevice() const {
+SkDevice* SkCanvas::getDevice() const {
// return root device
MCRec* rec = (MCRec*) fMCStack.front();
SkASSERT(rec && rec->fLayer);
return rec->fLayer->fDevice;
}
-SkBaseDevice* SkCanvas::getTopDevice(bool updateMatrixClip) const {
+SkDevice* SkCanvas::getTopDevice(bool updateMatrixClip) const {
if (updateMatrixClip) {
const_cast<SkCanvas*>(this)->updateDeviceCMCache();
}
return fMCRec->fTopLayer->fDevice;
}
-SkBaseDevice* SkCanvas::setDevice(SkBaseDevice* device) {
+SkDevice* SkCanvas::setDevice(SkDevice* device) {
// return root device
SkDeque::F2BIter iter(fMCStack);
MCRec* rec = (MCRec*)iter.next();
SkASSERT(rec && rec->fLayer);
- SkBaseDevice* rootDevice = rec->fLayer->fDevice;
+ SkDevice* rootDevice = rec->fLayer->fDevice;
if (rootDevice == device) {
return device;
@@ -644,7 +644,7 @@ SkBaseDevice* SkCanvas::setDevice(SkBaseDevice* device) {
bool SkCanvas::readPixels(SkBitmap* bitmap,
int x, int y,
Config8888 config8888) {
- SkBaseDevice* device = this->getDevice();
+ SkDevice* device = this->getDevice();
if (!device) {
return false;
}
@@ -652,7 +652,7 @@ bool SkCanvas::readPixels(SkBitmap* bitmap,
}
bool SkCanvas::readPixels(const SkIRect& srcRect, SkBitmap* bitmap) {
- SkBaseDevice* device = this->getDevice();
+ SkDevice* device = this->getDevice();
if (!device) {
return false;
}
@@ -676,7 +676,7 @@ bool SkCanvas::readPixels(const SkIRect& srcRect, SkBitmap* bitmap) {
void SkCanvas::writePixels(const SkBitmap& bitmap, int x, int y,
Config8888 config8888) {
- SkBaseDevice* device = this->getDevice();
+ SkDevice* device = this->getDevice();
if (device) {
if (SkIRect::Intersects(SkIRect::MakeSize(this->getDeviceSize()),
SkIRect::MakeXYWH(x, y, bitmap.width(), bitmap.height()))) {
@@ -748,7 +748,7 @@ static SkBitmap::Config resolve_config(SkCanvas* canvas,
uint32_t configMask = 0;
for (int i = canvas->countLayerDevices() - 1; i >= 0; --i)
{
- SkBaseDevice* device = canvas->getLayerDevice(i);
+ SkDevice* device = canvas->getLayerDevice(i);
if (device->intersects(bounds))
configMask |= 1 << device->config();
}
@@ -849,7 +849,7 @@ int SkCanvas::internalSaveLayer(const SkRect* bounds, const SkPaint* paint,
bool isOpaque;
SkBitmap::Config config = resolve_config(this, ir, flags, &isOpaque);
- SkBaseDevice* device;
+ SkDevice* device;
if (paint && paint->getImageFilter()) {
device = this->createCompatibleDevice(config, ir.width(), ir.height(),
isOpaque);
@@ -981,7 +981,7 @@ void SkCanvas::internalDrawBitmap(const SkBitmap& bitmap,
LOOPER_END
}
-void SkCanvas::internalDrawDevice(SkBaseDevice* srcDev, int x, int y,
+void SkCanvas::internalDrawDevice(SkDevice* srcDev, int x, int y,
const SkPaint* paint) {
SkPaint tmp;
if (NULL == paint) {
@@ -991,7 +991,7 @@ void SkCanvas::internalDrawDevice(SkBaseDevice* srcDev, int x, int y,
LOOPER_BEGIN_DRAWDEVICE(*paint, SkDrawFilter::kBitmap_Type)
while (iter.next()) {
- SkBaseDevice* dstDev = iter.fDevice;
+ SkDevice* dstDev = iter.fDevice;
paint = &looper.paint();
SkImageFilter* filter = paint->getImageFilter();
SkIPoint pos = { x - iter.getX(), y - iter.getY() };
@@ -1164,7 +1164,7 @@ static bool clipPathHelper(const SkCanvas* canvas, SkRasterClip* currClip,
return currClip->op(clip, op);
}
} else {
- const SkBaseDevice* device = canvas->getDevice();
+ const SkDevice* device = canvas->getDevice();
if (!device) {
return currClip->setEmpty();
}
@@ -1358,7 +1358,7 @@ bool SkCanvas::clipRegion(const SkRegion& rgn, SkRegion::Op op) {
#ifdef SK_DEBUG
void SkCanvas::validateClip() const {
// construct clipRgn from the clipstack
- const SkBaseDevice* device = this->getDevice();
+ const SkDevice* device = this->getDevice();
if (!device) {
SkASSERT(this->getTotalClip().isEmpty());
return;
@@ -1543,10 +1543,10 @@ const SkRegion& SkCanvas::getTotalClip() const {
return fMCRec->fRasterClip->forceGetBW();
}
-SkBaseDevice* SkCanvas::createLayerDevice(SkBitmap::Config config,
+SkDevice* SkCanvas::createLayerDevice(SkBitmap::Config config,
int width, int height,
bool isOpaque) {
- SkBaseDevice* device = this->getTopDevice();
+ SkDevice* device = this->getTopDevice();
if (device) {
return device->createCompatibleDeviceForSaveLayer(config, width, height,
isOpaque);
@@ -1555,10 +1555,10 @@ SkBaseDevice* SkCanvas::createLayerDevice(SkBitmap::Config config,
}
}
-SkBaseDevice* SkCanvas::createCompatibleDevice(SkBitmap::Config config,
+SkDevice* SkCanvas::createCompatibleDevice(SkBitmap::Config config,
int width, int height,
bool isOpaque) {
- SkBaseDevice* device = this->getDevice();
+ SkDevice* device = this->getDevice();
if (device) {
return device->createCompatibleDevice(config, width, height, isOpaque);
} else {
@@ -1874,8 +1874,8 @@ void SkCanvas::drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center,
class SkDeviceFilteredPaint {
public:
- SkDeviceFilteredPaint(SkBaseDevice* device, const SkPaint& paint) {
- SkBaseDevice::TextFlags flags;
+ SkDeviceFilteredPaint(SkDevice* device, const SkPaint& paint) {
+ SkDevice::TextFlags flags;
if (device->filterTextFlags(paint, &flags)) {
SkPaint* newPaint = fLazy.set(paint);
newPaint->setFlags(flags.fFlags);
@@ -2203,7 +2203,7 @@ void SkCanvas::LayerIter::next() {
fDone = !fImpl->next();
}
-SkBaseDevice* SkCanvas::LayerIter::device() const {
+SkDevice* SkCanvas::LayerIter::device() const {
return fImpl->getDevice();
}
diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp
index 428c9cae37..d06f6e677d 100644
--- a/src/core/SkDevice.cpp
+++ b/src/core/SkDevice.cpp
@@ -15,8 +15,7 @@
#include "SkRRect.h"
#include "SkShader.h"
-SK_DEFINE_INST_COUNT(SkBaseDevice)
-SK_DEFINE_INST_COUNT(SkBitmapDevice)
+SK_DEFINE_INST_COUNT(SkDevice)
///////////////////////////////////////////////////////////////////////////////
@@ -25,13 +24,20 @@ SK_DEFINE_INST_COUNT(SkBitmapDevice)
///////////////////////////////////////////////////////////////////////////////
-SkBitmapDevice::SkBitmapDevice(const SkBitmap& bitmap)
- : fBitmap(bitmap) {
+SkDevice::SkDevice(const SkBitmap& bitmap)
+ : fBitmap(bitmap), fLeakyProperties(SkDeviceProperties::MakeDefault())
+#ifdef SK_DEBUG
+ , fAttachedToCanvas(false)
+#endif
+{
+ fOrigin.setZero();
+ fMetaData = NULL;
+
SkASSERT(SkBitmap::kARGB_4444_Config != bitmap.config());
}
-SkBaseDevice::SkBaseDevice()
- : fLeakyProperties(SkDeviceProperties::MakeDefault())
+SkDevice::SkDevice(const SkBitmap& bitmap, const SkDeviceProperties& deviceProperties)
+ : fBitmap(bitmap), fLeakyProperties(deviceProperties)
#ifdef SK_DEBUG
, fAttachedToCanvas(false)
#endif
@@ -40,22 +46,15 @@ SkBaseDevice::SkBaseDevice()
fMetaData = NULL;
}
-SkBitmapDevice::SkBitmapDevice(const SkBitmap& bitmap, const SkDeviceProperties& deviceProperties)
- : SkBaseDevice(deviceProperties)
- , fBitmap(bitmap) {
-}
-
-SkBaseDevice::SkBaseDevice(const SkDeviceProperties& deviceProperties)
- : fLeakyProperties(deviceProperties)
+SkDevice::SkDevice(SkBitmap::Config config, int width, int height, bool isOpaque)
+ : fLeakyProperties(SkDeviceProperties::MakeDefault())
#ifdef SK_DEBUG
, fAttachedToCanvas(false)
#endif
{
fOrigin.setZero();
fMetaData = NULL;
-}
-SkBitmapDevice::SkBitmapDevice(SkBitmap::Config config, int width, int height, bool isOpaque) {
fBitmap.setConfig(config, width, height);
fBitmap.allocPixels();
fBitmap.setIsOpaque(isOpaque);
@@ -64,9 +63,15 @@ SkBitmapDevice::SkBitmapDevice(SkBitmap::Config config, int width, int height, b
}
}
-SkBitmapDevice::SkBitmapDevice(SkBitmap::Config config, int width, int height, bool isOpaque,
- const SkDeviceProperties& deviceProperties)
- : SkBaseDevice(deviceProperties) {
+SkDevice::SkDevice(SkBitmap::Config config, int width, int height, bool isOpaque,
+ const SkDeviceProperties& deviceProperties)
+ : fLeakyProperties(deviceProperties)
+#ifdef SK_DEBUG
+ , fAttachedToCanvas(false)
+#endif
+{
+ fOrigin.setZero();
+ fMetaData = NULL;
fBitmap.setConfig(config, width, height);
fBitmap.allocPixels();
@@ -76,43 +81,39 @@ SkBitmapDevice::SkBitmapDevice(SkBitmap::Config config, int width, int height, b
}
}
-SkBaseDevice::~SkBaseDevice() {
+SkDevice::~SkDevice() {
delete fMetaData;
}
-SkBitmapDevice::~SkBitmapDevice() {
-}
-
-void SkBitmapDevice::replaceBitmapBackendForRasterSurface(const SkBitmap& bm) {
+void SkDevice::replaceBitmapBackendForRasterSurface(const SkBitmap& bm) {
SkASSERT(bm.width() == fBitmap.width());
SkASSERT(bm.height() == fBitmap.height());
fBitmap = bm; // intent is to use bm's pixelRef (and rowbytes/config)
fBitmap.lockPixels();
}
-SkBaseDevice* SkBaseDevice::createCompatibleDevice(SkBitmap::Config config,
- int width, int height,
- bool isOpaque) {
+SkDevice* SkDevice::createCompatibleDevice(SkBitmap::Config config,
+ int width, int height,
+ bool isOpaque) {
return this->onCreateCompatibleDevice(config, width, height,
isOpaque, kGeneral_Usage);
}
-SkBaseDevice* SkBaseDevice::createCompatibleDeviceForSaveLayer(SkBitmap::Config config,
- int width, int height,
- bool isOpaque) {
+SkDevice* SkDevice::createCompatibleDeviceForSaveLayer(SkBitmap::Config config,
+ int width, int height,
+ bool isOpaque) {
return this->onCreateCompatibleDevice(config, width, height,
isOpaque, kSaveLayer_Usage);
}
-SkBaseDevice* SkBitmapDevice::onCreateCompatibleDevice(SkBitmap::Config config,
- int width, int height,
- bool isOpaque,
- Usage usage) {
- return SkNEW_ARGS(SkBitmapDevice,(config, width, height, isOpaque,
- this->getDeviceProperties()));
+SkDevice* SkDevice::onCreateCompatibleDevice(SkBitmap::Config config,
+ int width, int height,
+ bool isOpaque,
+ Usage usage) {
+ return SkNEW_ARGS(SkDevice,(config, width, height, isOpaque, fLeakyProperties));
}
-SkMetaData& SkBaseDevice::getMetaData() {
+SkMetaData& SkDevice::getMetaData() {
// metadata users are rare, so we lazily allocate it. If that changes we
// can decide to just make it a field in the device (rather than a ptr)
if (NULL == fMetaData) {
@@ -121,60 +122,61 @@ SkMetaData& SkBaseDevice::getMetaData() {
return *fMetaData;
}
-void SkBitmapDevice::lockPixels() {
+void SkDevice::lockPixels() {
if (fBitmap.lockPixelsAreWritable()) {
fBitmap.lockPixels();
}
}
-void SkBitmapDevice::unlockPixels() {
+void SkDevice::unlockPixels() {
if (fBitmap.lockPixelsAreWritable()) {
fBitmap.unlockPixels();
}
}
-const SkBitmap& SkBaseDevice::accessBitmap(bool changePixels) {
- const SkBitmap& bitmap = this->onAccessBitmap();
+const SkBitmap& SkDevice::accessBitmap(bool changePixels) {
+ const SkBitmap& bitmap = this->onAccessBitmap(&fBitmap);
if (changePixels) {
bitmap.notifyPixelsChanged();
}
return bitmap;
}
-void SkBitmapDevice::getGlobalBounds(SkIRect* bounds) const {
+void SkDevice::getGlobalBounds(SkIRect* bounds) const {
if (bounds) {
- const SkIPoint& origin = this->getOrigin();
- bounds->setXYWH(origin.x(), origin.y(),
+ bounds->setXYWH(fOrigin.x(), fOrigin.y(),
fBitmap.width(), fBitmap.height());
}
}
-void SkBitmapDevice::clear(SkColor color) {
+void SkDevice::clear(SkColor color) {
fBitmap.eraseColor(color);
}
-const SkBitmap& SkBitmapDevice::onAccessBitmap() {
- return fBitmap;
+const SkBitmap& SkDevice::onAccessBitmap(SkBitmap* bitmap) {return *bitmap;}
+
+void SkDevice::setMatrixClip(const SkMatrix& matrix, const SkRegion& region,
+ const SkClipStack& clipStack) {
}
-bool SkBitmapDevice::canHandleImageFilter(SkImageFilter*) {
+bool SkDevice::canHandleImageFilter(SkImageFilter*) {
return false;
}
-bool SkBitmapDevice::filterImage(SkImageFilter* filter, const SkBitmap& src,
- const SkMatrix& ctm, SkBitmap* result,
- SkIPoint* offset) {
+bool SkDevice::filterImage(SkImageFilter* filter, const SkBitmap& src,
+ const SkMatrix& ctm, SkBitmap* result,
+ SkIPoint* offset) {
return false;
}
-bool SkBitmapDevice::allowImageFilter(SkImageFilter*) {
+bool SkDevice::allowImageFilter(SkImageFilter*) {
return true;
}
///////////////////////////////////////////////////////////////////////////////
-bool SkBaseDevice::readPixels(SkBitmap* bitmap, int x, int y,
- SkCanvas::Config8888 config8888) {
+bool SkDevice::readPixels(SkBitmap* bitmap, int x, int y,
+ SkCanvas::Config8888 config8888) {
if (SkBitmap::kARGB_8888_Config != bitmap->config() ||
NULL != bitmap->getTexture()) {
return false;
@@ -218,21 +220,21 @@ bool SkBaseDevice::readPixels(SkBitmap* bitmap, int x, int y,
}
#if SK_PMCOLOR_BYTE_ORDER(B,G,R,A)
- const SkCanvas::Config8888 SkBaseDevice::kPMColorAlias =
+ const SkCanvas::Config8888 SkDevice::kPMColorAlias =
SkCanvas::kBGRA_Premul_Config8888;
#elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A)
- const SkCanvas::Config8888 SkBaseDevice::kPMColorAlias =
+ const SkCanvas::Config8888 SkDevice::kPMColorAlias =
SkCanvas::kRGBA_Premul_Config8888;
#else
- const SkCanvas::Config8888 SkBaseDevice::kPMColorAlias =
+ const SkCanvas::Config8888 SkDevice::kPMColorAlias =
(SkCanvas::Config8888) -1;
#endif
#include <SkConfig8888.h>
-bool SkBitmapDevice::onReadPixels(const SkBitmap& bitmap,
- int x, int y,
- SkCanvas::Config8888 config8888) {
+bool SkDevice::onReadPixels(const SkBitmap& bitmap,
+ int x, int y,
+ SkCanvas::Config8888 config8888) {
SkASSERT(SkBitmap::kARGB_8888_Config == bitmap.config());
SkASSERT(!bitmap.isNull());
SkASSERT(SkIRect::MakeWH(this->width(), this->height()).contains(SkIRect::MakeXYWH(x, y, bitmap.width(), bitmap.height())));
@@ -255,9 +257,9 @@ bool SkBitmapDevice::onReadPixels(const SkBitmap& bitmap,
return true;
}
-void SkBitmapDevice::writePixels(const SkBitmap& bitmap,
- int x, int y,
- SkCanvas::Config8888 config8888) {
+void SkDevice::writePixels(const SkBitmap& bitmap,
+ int x, int y,
+ SkCanvas::Config8888 config8888) {
if (bitmap.isNull() || bitmap.getTexture()) {
return;
}
@@ -326,22 +328,22 @@ void SkBitmapDevice::writePixels(const SkBitmap& bitmap,
///////////////////////////////////////////////////////////////////////////////
-void SkBitmapDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) {
+void SkDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) {
draw.drawPaint(paint);
}
-void SkBitmapDevice::drawPoints(const SkDraw& draw, SkCanvas::PointMode mode, size_t count,
- const SkPoint pts[], const SkPaint& paint) {
+void SkDevice::drawPoints(const SkDraw& draw, SkCanvas::PointMode mode, size_t count,
+ const SkPoint pts[], const SkPaint& paint) {
CHECK_FOR_NODRAW_ANNOTATION(paint);
draw.drawPoints(mode, count, pts, paint);
}
-void SkBitmapDevice::drawRect(const SkDraw& draw, const SkRect& r, const SkPaint& paint) {
+void SkDevice::drawRect(const SkDraw& draw, const SkRect& r, const SkPaint& paint) {
CHECK_FOR_NODRAW_ANNOTATION(paint);
draw.drawRect(r, paint);
}
-void SkBitmapDevice::drawOval(const SkDraw& draw, const SkRect& oval, const SkPaint& paint) {
+void SkDevice::drawOval(const SkDraw& draw, const SkRect& oval, const SkPaint& paint) {
CHECK_FOR_NODRAW_ANNOTATION(paint);
SkPath path;
@@ -351,7 +353,7 @@ void SkBitmapDevice::drawOval(const SkDraw& draw, const SkRect& oval, const SkPa
this->drawPath(draw, path, paint, NULL, true);
}
-void SkBitmapDevice::drawRRect(const SkDraw& draw, const SkRRect& rrect, const SkPaint& paint) {
+void SkDevice::drawRRect(const SkDraw& draw, const SkRRect& rrect, const SkPaint& paint) {
CHECK_FOR_NODRAW_ANNOTATION(paint);
SkPath path;
@@ -361,22 +363,22 @@ void SkBitmapDevice::drawRRect(const SkDraw& draw, const SkRRect& rrect, const S
this->drawPath(draw, path, paint, NULL, true);
}
-void SkBitmapDevice::drawPath(const SkDraw& draw, const SkPath& path,
- const SkPaint& paint, const SkMatrix* prePathMatrix,
- bool pathIsMutable) {
+void SkDevice::drawPath(const SkDraw& draw, const SkPath& path,
+ const SkPaint& paint, const SkMatrix* prePathMatrix,
+ bool pathIsMutable) {
CHECK_FOR_NODRAW_ANNOTATION(paint);
draw.drawPath(path, paint, prePathMatrix, pathIsMutable);
}
-void SkBitmapDevice::drawBitmap(const SkDraw& draw, const SkBitmap& bitmap,
- const SkMatrix& matrix, const SkPaint& paint) {
+void SkDevice::drawBitmap(const SkDraw& draw, const SkBitmap& bitmap,
+ const SkMatrix& matrix, const SkPaint& paint) {
draw.drawBitmap(bitmap, matrix, paint);
}
-void SkBitmapDevice::drawBitmapRect(const SkDraw& draw, const SkBitmap& bitmap,
- const SkRect* src, const SkRect& dst,
- const SkPaint& paint,
- SkCanvas::DrawBitmapRectFlags flags) {
+void SkDevice::drawBitmapRect(const SkDraw& draw, const SkBitmap& bitmap,
+ const SkRect* src, const SkRect& dst,
+ const SkPaint& paint,
+ SkCanvas::DrawBitmapRectFlags flags) {
SkMatrix matrix;
SkRect bitmapBounds, tmpSrc, tmpDst;
SkBitmap tmpBitmap;
@@ -460,56 +462,56 @@ void SkBitmapDevice::drawBitmapRect(const SkDraw& draw, const SkBitmap& bitmap,
this->drawRect(draw, *dstPtr, paintWithShader);
}
-void SkBitmapDevice::drawSprite(const SkDraw& draw, const SkBitmap& bitmap,
- int x, int y, const SkPaint& paint) {
+void SkDevice::drawSprite(const SkDraw& draw, const SkBitmap& bitmap,
+ int x, int y, const SkPaint& paint) {
draw.drawSprite(bitmap, x, y, paint);
}
-void SkBitmapDevice::drawText(const SkDraw& draw, const void* text, size_t len,
- SkScalar x, SkScalar y, const SkPaint& paint) {
+void SkDevice::drawText(const SkDraw& draw, const void* text, size_t len,
+ SkScalar x, SkScalar y, const SkPaint& paint) {
draw.drawText((const char*)text, len, x, y, paint);
}
-void SkBitmapDevice::drawPosText(const SkDraw& draw, const void* text, size_t len,
- const SkScalar xpos[], SkScalar y,
- int scalarsPerPos, const SkPaint& paint) {
+void SkDevice::drawPosText(const SkDraw& draw, const void* text, size_t len,
+ const SkScalar xpos[], SkScalar y,
+ int scalarsPerPos, const SkPaint& paint) {
draw.drawPosText((const char*)text, len, xpos, y, scalarsPerPos, paint);
}
-void SkBitmapDevice::drawTextOnPath(const SkDraw& draw, const void* text,
- size_t len, const SkPath& path,
- const SkMatrix* matrix,
- const SkPaint& paint) {
+void SkDevice::drawTextOnPath(const SkDraw& draw, const void* text,
+ size_t len, const SkPath& path,
+ const SkMatrix* matrix,
+ const SkPaint& paint) {
draw.drawTextOnPath((const char*)text, len, path, matrix, paint);
}
#ifdef SK_BUILD_FOR_ANDROID
-void SkBitmapDevice::drawPosTextOnPath(const SkDraw& draw, const void* text, size_t len,
- const SkPoint pos[], const SkPaint& paint,
- const SkPath& path, const SkMatrix* matrix) {
+void SkDevice::drawPosTextOnPath(const SkDraw& draw, const void* text, size_t len,
+ const SkPoint pos[], const SkPaint& paint,
+ const SkPath& path, const SkMatrix* matrix) {
draw.drawPosTextOnPath((const char*)text, len, pos, paint, path, matrix);
}
#endif
-void SkBitmapDevice::drawVertices(const SkDraw& draw, SkCanvas::VertexMode vmode,
- int vertexCount,
- const SkPoint verts[], const SkPoint textures[],
- const SkColor colors[], SkXfermode* xmode,
- const uint16_t indices[], int indexCount,
- const SkPaint& paint) {
+void SkDevice::drawVertices(const SkDraw& draw, SkCanvas::VertexMode vmode,
+ int vertexCount,
+ const SkPoint verts[], const SkPoint textures[],
+ const SkColor colors[], SkXfermode* xmode,
+ const uint16_t indices[], int indexCount,
+ const SkPaint& paint) {
draw.drawVertices(vmode, vertexCount, verts, textures, colors, xmode,
indices, indexCount, paint);
}
-void SkBitmapDevice::drawDevice(const SkDraw& draw, SkBaseDevice* device,
- int x, int y, const SkPaint& paint) {
+void SkDevice::drawDevice(const SkDraw& draw, SkDevice* device,
+ int x, int y, const SkPaint& paint) {
const SkBitmap& src = device->accessBitmap(false);
draw.drawSprite(src, x, y, paint);
}
///////////////////////////////////////////////////////////////////////////////
-bool SkBitmapDevice::filterTextFlags(const SkPaint& paint, TextFlags* flags) {
+bool SkDevice::filterTextFlags(const SkPaint& paint, TextFlags* flags) {
if (!paint.isLCDRenderText() || !paint.isAntiAlias()) {
// we're cool with the paint as is
return false;
diff --git a/src/core/SkDeviceImageFilterProxy.h b/src/core/SkDeviceImageFilterProxy.h
index 03fcb68125..98a120cd0d 100644
--- a/src/core/SkDeviceImageFilterProxy.h
+++ b/src/core/SkDeviceImageFilterProxy.h
@@ -12,9 +12,9 @@
class SkDeviceImageFilterProxy : public SkImageFilter::Proxy {
public:
- SkDeviceImageFilterProxy(SkBaseDevice* device) : fDevice(device) {}
+ SkDeviceImageFilterProxy(SkDevice* device) : fDevice(device) {}
- virtual SkBaseDevice* createDevice(int w, int h) SK_OVERRIDE {
+ virtual SkDevice* createDevice(int w, int h) SK_OVERRIDE {
return fDevice->createCompatibleDevice(SkBitmap::kARGB_8888_Config,
w, h, false);
}
@@ -28,7 +28,7 @@ public:
}
private:
- SkBaseDevice* fDevice;
+ SkDevice* fDevice;
};
#endif
diff --git a/src/core/SkPicture.cpp b/src/core/SkPicture.cpp
index 416b9127ca..097e0ea0c7 100644
--- a/src/core/SkPicture.cpp
+++ b/src/core/SkPicture.cpp
@@ -205,7 +205,7 @@ SkCanvas* SkPicture::beginRecording(int width, int height,
SkBitmap bm;
bm.setConfig(SkBitmap::kNo_Config, width, height);
- SkAutoTUnref<SkBaseDevice> dev(SkNEW_ARGS(SkBitmapDevice, (bm)));
+ SkAutoTUnref<SkDevice> dev(SkNEW_ARGS(SkDevice, (bm)));
// Must be set before calling createBBoxHierarchy
fWidth = width;
diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp
index ea1a40f731..0ec9eaf74d 100644
--- a/src/core/SkPictureRecord.cpp
+++ b/src/core/SkPictureRecord.cpp
@@ -28,7 +28,7 @@ static const uint32_t kSaveSize = 2 * kUInt32Size;
static const uint32_t kSaveLayerNoBoundsSize = 4 * kUInt32Size;
static const uint32_t kSaveLayerWithBoundsSize = 4 * kUInt32Size + sizeof(SkRect);
-SkPictureRecord::SkPictureRecord(uint32_t flags, SkBaseDevice* device) :
+SkPictureRecord::SkPictureRecord(uint32_t flags, SkDevice* device) :
INHERITED(device),
fBoundingHierarchy(NULL),
fStateTree(NULL),
@@ -138,7 +138,7 @@ static inline uint32_t getPaintOffset(DrawType op, uint32_t opSize) {
return gPaintOffsets[op] * sizeof(uint32_t) + overflow;
}
-SkBaseDevice* SkPictureRecord::setDevice(SkBaseDevice* device) {
+SkDevice* SkPictureRecord::setDevice(SkDevice* device) {
SkASSERT(!"eeek, don't try to change the device on a recording canvas");
return this->INHERITED::setDevice(device);
}
diff --git a/src/core/SkPictureRecord.h b/src/core/SkPictureRecord.h
index 34cd9255ec..51547a4741 100644
--- a/src/core/SkPictureRecord.h
+++ b/src/core/SkPictureRecord.h
@@ -30,10 +30,10 @@ class SkBBoxHierarchy;
class SkPictureRecord : public SkCanvas {
public:
- SkPictureRecord(uint32_t recordFlags, SkBaseDevice*);
+ SkPictureRecord(uint32_t recordFlags, SkDevice*);
virtual ~SkPictureRecord();
- virtual SkBaseDevice* setDevice(SkBaseDevice* device) SK_OVERRIDE;
+ virtual SkDevice* setDevice(SkDevice* device) SK_OVERRIDE;
virtual int save(SaveFlags) SK_OVERRIDE;
virtual int saveLayer(const SkRect* bounds, const SkPaint*, SaveFlags) SK_OVERRIDE;
diff --git a/src/device/xps/SkXPSDevice.cpp b/src/device/xps/SkXPSDevice.cpp
index 311c09f425..442a51f507 100644
--- a/src/device/xps/SkXPSDevice.cpp
+++ b/src/device/xps/SkXPSDevice.cpp
@@ -111,7 +111,7 @@ static SkBitmap make_fake_bitmap(int width, int height) {
}
SkXPSDevice::SkXPSDevice()
- : SkBitmapDevice(make_fake_bitmap(10000, 10000))
+ : SkDevice(make_fake_bitmap(10000, 10000))
, fCurrentPage(0) {
}
@@ -2375,7 +2375,7 @@ void SkXPSDevice::drawTextOnPath(const SkDraw& d, const void* text, size_t len,
d.drawTextOnPath((const char*)text, len, path, matrix, paint);
}
-void SkXPSDevice::drawDevice(const SkDraw& d, SkBaseDevice* dev,
+void SkXPSDevice::drawDevice(const SkDraw& d, SkDevice* dev,
int x, int y,
const SkPaint&) {
SkXPSDevice* that = static_cast<SkXPSDevice*>(dev);
@@ -2407,11 +2407,11 @@ bool SkXPSDevice::onReadPixels(const SkBitmap& bitmap, int x, int y,
return false;
}
-SkBaseDevice* SkXPSDevice::onCreateCompatibleDevice(SkBitmap::Config config,
- int width, int height,
- bool isOpaque,
- Usage usage) {
- if (SkBaseDevice::kGeneral_Usage == usage) {
+SkDevice* SkXPSDevice::onCreateCompatibleDevice(SkBitmap::Config config,
+ int width, int height,
+ bool isOpaque,
+ Usage usage) {
+ if (SkDevice::kGeneral_Usage == usage) {
return NULL;
SK_CRASH();
//To what stream do we write?
@@ -2425,7 +2425,7 @@ SkBaseDevice* SkXPSDevice::onCreateCompatibleDevice(SkBitmap::Config config,
}
SkXPSDevice::SkXPSDevice(IXpsOMObjectFactory* xpsFactory)
- : SkBitmapDevice(make_fake_bitmap(10000, 10000))
+ : SkDevice(make_fake_bitmap(10000, 10000))
, fCurrentPage(0) {
HRVM(CoCreateInstance(
diff --git a/src/effects/SkColorFilterImageFilter.cpp b/src/effects/SkColorFilterImageFilter.cpp
index 6ef88e3c5b..9c2c54eb56 100755
--- a/src/effects/SkColorFilterImageFilter.cpp
+++ b/src/effects/SkColorFilterImageFilter.cpp
@@ -111,7 +111,7 @@ bool SkColorFilterImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& sourc
return false;
}
- SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bounds.height()));
+ SkAutoTUnref<SkDevice> device(proxy->createDevice(bounds.width(), bounds.height()));
SkCanvas canvas(device.get());
SkPaint paint;
diff --git a/src/effects/SkDropShadowImageFilter.cpp b/src/effects/SkDropShadowImageFilter.cpp
index 75a86689c0..b8bbfd6f31 100644
--- a/src/effects/SkDropShadowImageFilter.cpp
+++ b/src/effects/SkDropShadowImageFilter.cpp
@@ -46,7 +46,7 @@ bool SkDropShadowImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& source
if (getInput(0) && !getInput(0)->filterImage(proxy, source, matrix, &src, loc))
return false;
- SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(src.width(), src.height()));
+ SkAutoTUnref<SkDevice> device(proxy->createDevice(src.width(), src.height()));
SkCanvas canvas(device.get());
SkAutoTUnref<SkImageFilter> blurFilter(new SkBlurImageFilter(fSigma, fSigma));
diff --git a/src/effects/SkMergeImageFilter.cpp b/src/effects/SkMergeImageFilter.cpp
index 0c47c91aff..0c1388f944 100755
--- a/src/effects/SkMergeImageFilter.cpp
+++ b/src/effects/SkMergeImageFilter.cpp
@@ -109,7 +109,7 @@ bool SkMergeImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src,
const int x0 = bounds.left();
const int y0 = bounds.top();
- SkAutoTUnref<SkBaseDevice> dst(proxy->createDevice(bounds.width(), bounds.height()));
+ SkAutoTUnref<SkDevice> dst(proxy->createDevice(bounds.width(), bounds.height()));
if (NULL == dst) {
return false;
}
diff --git a/src/effects/SkRectShaderImageFilter.cpp b/src/effects/SkRectShaderImageFilter.cpp
index 2ee1d4a2ed..ada861fd5c 100644
--- a/src/effects/SkRectShaderImageFilter.cpp
+++ b/src/effects/SkRectShaderImageFilter.cpp
@@ -56,8 +56,8 @@ bool SkRectShaderImageFilter::onFilterImage(Proxy* proxy,
return false;
}
- SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(SkScalarCeilToInt(rect.width()),
- SkScalarCeilToInt(rect.height())));
+ SkAutoTUnref<SkDevice> device(proxy->createDevice(SkScalarCeilToInt(rect.width()),
+ SkScalarCeilToInt(rect.height())));
SkCanvas canvas(device.get());
SkPaint paint;
paint.setShader(fShader);
diff --git a/src/effects/SkTestImageFilters.cpp b/src/effects/SkTestImageFilters.cpp
index 788c33a411..a919dedd41 100755
--- a/src/effects/SkTestImageFilters.cpp
+++ b/src/effects/SkTestImageFilters.cpp
@@ -9,11 +9,11 @@
// with the following:
//
// SkCanvas canvas(device);
-// SkAutoTUnref<SkBaseDevice> aur(device);
+// SkAutoTUnref<SkDevice> aur(device);
//
class OwnDeviceCanvas : public SkCanvas {
public:
- OwnDeviceCanvas(SkBaseDevice* device) : SkCanvas(device) {
+ OwnDeviceCanvas(SkDevice* device) : SkCanvas(device) {
SkSafeUnref(device);
}
};
@@ -41,7 +41,7 @@ bool SkDownSampleImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src,
// downsample
{
- SkBaseDevice* dev = proxy->createDevice(dstW, dstH);
+ SkDevice* dev = proxy->createDevice(dstW, dstH);
if (NULL == dev) {
return false;
}
@@ -56,7 +56,7 @@ bool SkDownSampleImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src,
// upscale
{
- SkBaseDevice* dev = proxy->createDevice(src.width(), src.height());
+ SkDevice* dev = proxy->createDevice(src.width(), src.height());
if (NULL == dev) {
return false;
}
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 4a89ef3106..d96ffb84a3 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -161,12 +161,12 @@ SkGpuDevice* SkGpuDevice::Create(GrSurface* surface) {
}
SkGpuDevice::SkGpuDevice(GrContext* context, GrTexture* texture)
- : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) {
+: SkDevice(make_bitmap(context, texture->asRenderTarget())) {
this->initFromRenderTarget(context, texture->asRenderTarget(), false);
}
SkGpuDevice::SkGpuDevice(GrContext* context, GrRenderTarget* renderTarget)
- : SkBitmapDevice(make_bitmap(context, renderTarget)) {
+: SkDevice(make_bitmap(context, renderTarget)) {
this->initFromRenderTarget(context, renderTarget, false);
}
@@ -203,7 +203,7 @@ SkGpuDevice::SkGpuDevice(GrContext* context,
int width,
int height,
int sampleCount)
- : SkBitmapDevice(config, width, height, false /*isOpaque*/) {
+ : SkDevice(config, width, height, false /*isOpaque*/) {
fDrawProcs = NULL;
@@ -1436,7 +1436,7 @@ void SkGpuDevice::internalDrawBitmap(const SkBitmap& bitmap,
fContext->drawRectToRect(grPaint, dstRect, paintRect, &m);
}
-static bool filter_texture(SkBaseDevice* device, GrContext* context,
+static bool filter_texture(SkDevice* device, GrContext* context,
GrTexture* texture, SkImageFilter* filter,
int w, int h, const SkMatrix& ctm, SkBitmap* result,
SkIPoint* offset) {
@@ -1535,7 +1535,7 @@ void SkGpuDevice::drawBitmapRect(const SkDraw& draw, const SkBitmap& bitmap,
this->drawBitmapCommon(draw, bitmap, &tmpSrc, matrix, paint, flags);
}
-void SkGpuDevice::drawDevice(const SkDraw& draw, SkBaseDevice* device,
+void SkGpuDevice::drawDevice(const SkDraw& draw, SkDevice* device,
int x, int y, const SkPaint& paint) {
// clear of the source device must occur before CHECK_SHOULD_DRAW
SkGpuDevice* dev = static_cast<SkGpuDevice*>(device);
@@ -1818,10 +1818,10 @@ void SkGpuDevice::flush() {
///////////////////////////////////////////////////////////////////////////////
-SkBaseDevice* SkGpuDevice::onCreateCompatibleDevice(SkBitmap::Config config,
- int width, int height,
- bool isOpaque,
- Usage usage) {
+SkDevice* SkGpuDevice::onCreateCompatibleDevice(SkBitmap::Config config,
+ int width, int height,
+ bool isOpaque,
+ Usage usage) {
GrTextureDesc desc;
desc.fConfig = fRenderTarget->config();
desc.fFlags = kRenderTarget_GrTextureFlagBit;
@@ -1854,7 +1854,7 @@ SkBaseDevice* SkGpuDevice::onCreateCompatibleDevice(SkBitmap::Config config,
SkGpuDevice::SkGpuDevice(GrContext* context,
GrTexture* texture,
bool needClear)
- : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) {
+ : SkDevice(make_bitmap(context, texture->asRenderTarget())) {
SkASSERT(texture && texture->asRenderTarget());
// This constructor is called from onCreateCompatibleDevice. It has locked the RT in the texture
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index 02dda02451..a24c4ecd8a 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -566,10 +566,10 @@ void GraphicStackState::updateDrawingState(const GraphicStateEntry& state) {
}
}
-SkBaseDevice* SkPDFDevice::onCreateCompatibleDevice(SkBitmap::Config config,
- int width, int height,
- bool isOpaque,
- Usage usage) {
+SkDevice* SkPDFDevice::onCreateCompatibleDevice(SkBitmap::Config config,
+ int width, int height,
+ bool isOpaque,
+ Usage usage) {
SkMatrix initialTransform;
initialTransform.reset();
SkISize size = SkISize::Make(width, height);
@@ -672,7 +672,7 @@ static inline SkBitmap makeContentBitmap(const SkISize& contentSize,
// TODO(vandebo) change pageSize to SkSize.
SkPDFDevice::SkPDFDevice(const SkISize& pageSize, const SkISize& contentSize,
const SkMatrix& initialTransform)
- : SkBitmapDevice(makeContentBitmap(contentSize, &initialTransform)),
+ : SkDevice(makeContentBitmap(contentSize, &initialTransform)),
fPageSize(pageSize),
fContentSize(contentSize),
fLastContentEntry(NULL),
@@ -696,7 +696,7 @@ SkPDFDevice::SkPDFDevice(const SkISize& pageSize, const SkISize& contentSize,
SkPDFDevice::SkPDFDevice(const SkISize& layerSize,
const SkClipStack& existingClipStack,
const SkRegion& existingClipRegion)
- : SkBitmapDevice(makeContentBitmap(layerSize, NULL)),
+ : SkDevice(makeContentBitmap(layerSize, NULL)),
fPageSize(layerSize),
fContentSize(layerSize),
fExistingClipStack(existingClipStack),
@@ -1153,11 +1153,11 @@ void SkPDFDevice::drawVertices(const SkDraw& d, SkCanvas::VertexMode,
NOT_IMPLEMENTED("drawVerticies", true);
}
-void SkPDFDevice::drawDevice(const SkDraw& d, SkBaseDevice* device, int x, int y,
+void SkPDFDevice::drawDevice(const SkDraw& d, SkDevice* device, int x, int y,
const SkPaint& paint) {
if ((device->getDeviceCapabilities() & kVector_Capability) == 0) {
// If we somehow get a raster device, do what our parent would do.
- INHERITED::drawDevice(d, device, x, y, paint);
+ SkDevice::drawDevice(d, device, x, y, paint);
return;
}
diff --git a/src/pipe/SkGPipeWrite.cpp b/src/pipe/SkGPipeWrite.cpp
index 647b15c286..f646babda5 100644
--- a/src/pipe/SkGPipeWrite.cpp
+++ b/src/pipe/SkGPipeWrite.cpp
@@ -432,7 +432,7 @@ SkGPipeCanvas::SkGPipeCanvas(SkGPipeController* controller,
// We don't allocate pixels for the bitmap
SkBitmap bitmap;
bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height);
- SkBaseDevice* device = SkNEW_ARGS(SkBitmapDevice, (bitmap));
+ SkDevice* device = SkNEW_ARGS(SkDevice, (bitmap));
this->setDevice(device)->unref();
// Tell the reader the appropriate flags to use.
diff --git a/src/pipe/utils/SamplePipeControllers.cpp b/src/pipe/utils/SamplePipeControllers.cpp
index e329886894..a23d77537c 100644
--- a/src/pipe/utils/SamplePipeControllers.cpp
+++ b/src/pipe/utils/SamplePipeControllers.cpp
@@ -55,7 +55,7 @@ TiledPipeController::TiledPipeController(const SkBitmap& bitmap,
SkDEBUGCODE(bool extracted = )bitmap.extractSubset(&fBitmaps[i], rect);
SkASSERT(extracted);
- SkBaseDevice* device = new SkBitmapDevice(fBitmaps[i]);
+ SkDevice* device = new SkDevice(fBitmaps[i]);
SkCanvas* canvas = new SkCanvas(device);
device->unref();
if (initial != NULL) {
diff --git a/src/utils/SkDeferredCanvas.cpp b/src/utils/SkDeferredCanvas.cpp
index 41b7c02bca..e3b761f0e0 100644
--- a/src/utils/SkDeferredCanvas.cpp
+++ b/src/utils/SkDeferredCanvas.cpp
@@ -137,16 +137,16 @@ void DeferredPipeController::playback(bool silent) {
//-----------------------------------------------------------------------------
// DeferredDevice
//-----------------------------------------------------------------------------
-class DeferredDevice : public SkBitmapDevice {
+class DeferredDevice : public SkDevice {
public:
- explicit DeferredDevice(SkBaseDevice* immediateDevice);
+ explicit DeferredDevice(SkDevice* immediateDevice);
explicit DeferredDevice(SkSurface* surface);
~DeferredDevice();
void setNotificationClient(SkDeferredCanvas::NotificationClient* notificationClient);
SkCanvas* recordingCanvas();
SkCanvas* immediateCanvas() const {return fImmediateCanvas;}
- SkBaseDevice* immediateDevice() const {return fImmediateCanvas->getTopDevice();}
+ SkDevice* immediateDevice() const {return fImmediateCanvas->getTopDevice();}
SkImage* newImageSnapshot();
void setSurface(SkSurface* surface);
bool isFreshFrame();
@@ -165,24 +165,24 @@ public:
virtual int height() const SK_OVERRIDE;
virtual GrRenderTarget* accessRenderTarget() SK_OVERRIDE;
- virtual SkBaseDevice* onCreateCompatibleDevice(SkBitmap::Config config,
- int width, int height,
- bool isOpaque,
- Usage usage) SK_OVERRIDE;
+ virtual SkDevice* onCreateCompatibleDevice(SkBitmap::Config config,
+ int width, int height,
+ bool isOpaque,
+ Usage usage) SK_OVERRIDE;
virtual void writePixels(const SkBitmap& bitmap, int x, int y,
SkCanvas::Config8888 config8888) SK_OVERRIDE;
protected:
- virtual const SkBitmap& onAccessBitmap() SK_OVERRIDE;
+ virtual const SkBitmap& onAccessBitmap(SkBitmap*) SK_OVERRIDE;
virtual bool onReadPixels(const SkBitmap& bitmap,
int x, int y,
SkCanvas::Config8888 config8888) SK_OVERRIDE;
// The following methods are no-ops on a deferred device
- virtual bool filterTextFlags(const SkPaint& paint, TextFlags*) SK_OVERRIDE {
- return false;
- }
+ virtual bool filterTextFlags(const SkPaint& paint, TextFlags*)
+ SK_OVERRIDE
+ {return false;}
// None of the following drawing methods should ever get called on the
// deferred device
@@ -234,7 +234,7 @@ protected:
SkXfermode* xmode, const uint16_t indices[],
int indexCount, const SkPaint& paint) SK_OVERRIDE
{SkASSERT(0);}
- virtual void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y,
+ virtual void drawDevice(const SkDraw&, SkDevice*, int x, int y,
const SkPaint&) SK_OVERRIDE
{SkASSERT(0);}
private:
@@ -258,11 +258,11 @@ private:
size_t fBitmapSizeThreshold;
};
-DeferredDevice::DeferredDevice(SkBaseDevice* immediateDevice)
- : SkBitmapDevice(SkBitmap::kNo_Config,
- immediateDevice->width(), immediateDevice->height(),
- immediateDevice->isOpaque(),
- immediateDevice->getDeviceProperties()) {
+DeferredDevice::DeferredDevice(SkDevice* immediateDevice)
+ : SkDevice(SkBitmap::kNo_Config,
+ immediateDevice->width(), immediateDevice->height(),
+ immediateDevice->isOpaque(),
+ immediateDevice->getDeviceProperties()) {
fSurface = NULL;
fImmediateCanvas = SkNEW_ARGS(SkCanvas, (immediateDevice));
fPipeController.setPlaybackCanvas(fImmediateCanvas);
@@ -270,11 +270,11 @@ DeferredDevice::DeferredDevice(SkBaseDevice* immediateDevice)
}
DeferredDevice::DeferredDevice(SkSurface* surface)
- : SkBitmapDevice(SkBitmap::kNo_Config,
- surface->getCanvas()->getDevice()->width(),
- surface->getCanvas()->getDevice()->height(),
- surface->getCanvas()->getDevice()->isOpaque(),
- surface->getCanvas()->getDevice()->getDeviceProperties()) {
+ : SkDevice(SkBitmap::kNo_Config,
+ surface->getCanvas()->getDevice()->width(),
+ surface->getCanvas()->getDevice()->height(),
+ surface->getCanvas()->getDevice()->isOpaque(),
+ surface->getCanvas()->getDevice()->getDeviceProperties()) {
fMaxRecordingStorageBytes = kDefaultMaxRecordingStorageBytes;
fNotificationClient = NULL;
fImmediateCanvas = NULL;
@@ -492,12 +492,12 @@ void DeferredDevice::writePixels(const SkBitmap& bitmap,
}
}
-const SkBitmap& DeferredDevice::onAccessBitmap() {
+const SkBitmap& DeferredDevice::onAccessBitmap(SkBitmap*) {
this->flushPendingCommands(kNormal_PlaybackMode);
return immediateDevice()->accessBitmap(false);
}
-SkBaseDevice* DeferredDevice::onCreateCompatibleDevice(
+SkDevice* DeferredDevice::onCreateCompatibleDevice(
SkBitmap::Config config, int width, int height, bool isOpaque,
Usage usage) {
@@ -555,7 +555,7 @@ SkDeferredCanvas* SkDeferredCanvas::Create(SkSurface* surface) {
return SkNEW_ARGS(SkDeferredCanvas, (deferredDevice));
}
-SkDeferredCanvas* SkDeferredCanvas::Create(SkBaseDevice* device) {
+SkDeferredCanvas* SkDeferredCanvas::Create(SkDevice* device) {
SkAutoTUnref<DeferredDevice> deferredDevice(SkNEW_ARGS(DeferredDevice, (device)));
return SkNEW_ARGS(SkDeferredCanvas, (deferredDevice));
}
diff --git a/src/utils/SkPictureUtils.cpp b/src/utils/SkPictureUtils.cpp
index 8c0aca8e21..87a4057ebd 100644
--- a/src/utils/SkPictureUtils.cpp
+++ b/src/utils/SkPictureUtils.cpp
@@ -47,7 +47,7 @@ static void nothing_to_do() {}
* It should never actually draw anything, so there need not be any pixels
* behind its device-bitmap.
*/
-class GatherPixelRefDevice : public SkBitmapDevice {
+class GatherPixelRefDevice : public SkDevice {
private:
PixelRefSet* fPRSet;
@@ -70,7 +70,7 @@ private:
}
public:
- GatherPixelRefDevice(const SkBitmap& bm, PixelRefSet* prset) : SkBitmapDevice(bm) {
+ GatherPixelRefDevice(const SkBitmap& bm, PixelRefSet* prset) : SkDevice(bm) {
fPRSet = prset;
}
@@ -138,7 +138,7 @@ public:
const SkPaint& paint) SK_OVERRIDE {
this->addBitmapFromPaint(paint);
}
- virtual void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y,
+ virtual void drawDevice(const SkDraw&, SkDevice*, int x, int y,
const SkPaint&) SK_OVERRIDE {
nothing_to_do();
}
@@ -150,14 +150,11 @@ protected:
not_supported();
return false;
}
-
-private:
- typedef SkBitmapDevice INHERITED;
};
class NoSaveLayerCanvas : public SkCanvas {
public:
- NoSaveLayerCanvas(SkBaseDevice* device) : INHERITED(device) {}
+ NoSaveLayerCanvas(SkDevice* device) : INHERITED(device) {}
// turn saveLayer() into save() for speed, should not affect correctness.
virtual int saveLayer(const SkRect* bounds, const SkPaint* paint,
diff --git a/tests/CanvasTest.cpp b/tests/CanvasTest.cpp
index 24c3348d15..26896fc425 100644
--- a/tests/CanvasTest.cpp
+++ b/tests/CanvasTest.cpp
@@ -779,7 +779,7 @@ public:
SkBitmap deferredStore;
createBitmap(&deferredStore, SkBitmap::kARGB_8888_Config, 0xFFFFFFFF);
- SkBitmapDevice deferredDevice(deferredStore);
+ SkDevice deferredDevice(deferredStore);
SkAutoTUnref<SkDeferredCanvas> deferredCanvas(SkDeferredCanvas::Create(&deferredDevice));
testStep->setAssertMessageFormat(kDeferredDrawAssertMessageFormat);
testStep->draw(deferredCanvas, reporter);
@@ -821,7 +821,7 @@ static void TestProxyCanvasStateConsistency(
SkBitmap indirectStore;
createBitmap(&indirectStore, SkBitmap::kARGB_8888_Config, 0xFFFFFFFF);
- SkBitmapDevice indirectDevice(indirectStore);
+ SkDevice indirectDevice(indirectStore);
SkCanvas indirectCanvas(&indirectDevice);
SkProxyCanvas proxyCanvas(&indirectCanvas);
testStep->setAssertMessageFormat(kProxyDrawAssertMessageFormat);
@@ -844,12 +844,12 @@ static void TestNWayCanvasStateConsistency(
SkBitmap indirectStore1;
createBitmap(&indirectStore1, SkBitmap::kARGB_8888_Config, 0xFFFFFFFF);
- SkBitmapDevice indirectDevice1(indirectStore1);
+ SkDevice indirectDevice1(indirectStore1);
SkCanvas indirectCanvas1(&indirectDevice1);
SkBitmap indirectStore2;
createBitmap(&indirectStore2, SkBitmap::kARGB_8888_Config, 0xFFFFFFFF);
- SkBitmapDevice indirectDevice2(indirectStore2);
+ SkDevice indirectDevice2(indirectStore2);
SkCanvas indirectCanvas2(&indirectDevice2);
SkISize canvasSize = referenceCanvas.getDeviceSize();
@@ -882,7 +882,7 @@ static void TestOverrideStateConsistency(skiatest::Reporter* reporter,
CanvasTestStep* testStep) {
SkBitmap referenceStore;
createBitmap(&referenceStore, SkBitmap::kARGB_8888_Config, 0xFFFFFFFF);
- SkBitmapDevice referenceDevice(referenceStore);
+ SkDevice referenceDevice(referenceStore);
SkCanvas referenceCanvas(&referenceDevice);
testStep->setAssertMessageFormat(kCanvasDrawAssertMessageFormat);
testStep->draw(&referenceCanvas, reporter);
diff --git a/tests/DeferredCanvasTest.cpp b/tests/DeferredCanvasTest.cpp
index d7ee761bd9..15474f5bb4 100644
--- a/tests/DeferredCanvasTest.cpp
+++ b/tests/DeferredCanvasTest.cpp
@@ -33,7 +33,7 @@ static void TestDeferredCanvasBitmapAccess(skiatest::Reporter* reporter) {
SkBitmap store;
create(&store, SkBitmap::kARGB_8888_Config, 0xFFFFFFFF);
- SkBitmapDevice device(store);
+ SkDevice device(store);
SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(&device));
canvas->clear(0x00000000);
@@ -259,7 +259,7 @@ static void TestDeferredCanvasFlush(skiatest::Reporter* reporter) {
SkBitmap store;
create(&store, SkBitmap::kARGB_8888_Config, 0xFFFFFFFF);
- SkBitmapDevice device(store);
+ SkDevice device(store);
SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(&device));
canvas->clear(0x00000000);
@@ -279,7 +279,7 @@ static void TestDeferredCanvasFreshFrame(skiatest::Reporter* reporter) {
partialRect.setXYWH(SkIntToScalar(0), SkIntToScalar(0),
SkIntToScalar(1), SkIntToScalar(1));
create(&store, SkBitmap::kARGB_8888_Config, 0xFFFFFFFF);
- SkBitmapDevice device(store);
+ SkDevice device(store);
SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(&device));
// verify that frame is intially fresh
@@ -433,9 +433,9 @@ static void TestDeferredCanvasFreshFrame(skiatest::Reporter* reporter) {
}
}
-class MockDevice : public SkBitmapDevice {
+class MockDevice : public SkDevice {
public:
- MockDevice(const SkBitmap& bm) : SkBitmapDevice(bm) {
+ MockDevice(const SkBitmap& bm) : SkDevice(bm) {
fDrawBitmapCallCount = 0;
}
virtual void drawBitmap(const SkDraw&, const SkBitmap&,
@@ -502,7 +502,7 @@ static void TestDeferredCanvasBitmapCaching(skiatest::Reporter* reporter) {
SkBitmap store;
store.setConfig(SkBitmap::kARGB_8888_Config, 100, 100);
store.allocPixels();
- SkBitmapDevice device(store);
+ SkDevice device(store);
NotificationCounter notificationCounter;
SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(&device));
canvas->setNotificationClient(&notificationCounter);
@@ -585,7 +585,7 @@ static void TestDeferredCanvasSkip(skiatest::Reporter* reporter) {
SkBitmap store;
store.setConfig(SkBitmap::kARGB_8888_Config, 100, 100);
store.allocPixels();
- SkBitmapDevice device(store);
+ SkDevice device(store);
NotificationCounter notificationCounter;
SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(&device));
canvas->setNotificationClient(&notificationCounter);
@@ -606,7 +606,7 @@ static void TestDeferredCanvasBitmapShaderNoLeak(skiatest::Reporter* reporter) {
SkBitmap store;
store.setConfig(SkBitmap::kARGB_8888_Config, 100, 100);
store.allocPixels();
- SkBitmapDevice device(store);
+ SkDevice device(store);
SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(&device));
// test will fail if nbIterations is not in sync with
// BITMAPS_TO_KEEP in SkGPipeWrite.cpp
@@ -652,7 +652,7 @@ static void TestDeferredCanvasBitmapSizeThreshold(skiatest::Reporter* reporter)
// 1 under : should not store the image
{
- SkBitmapDevice device(store);
+ SkDevice device(store);
SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(&device));
canvas->setBitmapSizeThreshold(39999);
canvas->drawBitmap(sourceImage, 0, 0, NULL);
@@ -662,7 +662,7 @@ static void TestDeferredCanvasBitmapSizeThreshold(skiatest::Reporter* reporter)
// exact value : should store the image
{
- SkBitmapDevice device(store);
+ SkDevice device(store);
SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(&device));
canvas->setBitmapSizeThreshold(40000);
canvas->drawBitmap(sourceImage, 0, 0, NULL);
@@ -672,7 +672,7 @@ static void TestDeferredCanvasBitmapSizeThreshold(skiatest::Reporter* reporter)
// 1 over : should still store the image
{
- SkBitmapDevice device(store);
+ SkDevice device(store);
SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(&device));
canvas->setBitmapSizeThreshold(40001);
canvas->drawBitmap(sourceImage, 0, 0, NULL);
@@ -807,11 +807,11 @@ static void TestDeferredCanvasCreateCompatibleDevice(skiatest::Reporter* reporte
SkBitmap store;
store.setConfig(SkBitmap::kARGB_8888_Config, 100, 100);
store.allocPixels();
- SkBitmapDevice device(store);
+ SkDevice device(store);
NotificationCounter notificationCounter;
SkAutoTUnref<SkDeferredCanvas> canvas(SkDeferredCanvas::Create(&device));
canvas->setNotificationClient(&notificationCounter);
- SkAutoTUnref<SkBaseDevice> secondaryDevice(canvas->createCompatibleDevice(
+ SkAutoTUnref<SkDevice> secondaryDevice(canvas->createCompatibleDevice(
SkBitmap::kARGB_8888_Config, 10, 10, device.isOpaque()));
SkCanvas secondaryCanvas(secondaryDevice.get());
SkRect rect = SkRect::MakeWH(5, 5);
diff --git a/tests/GradientTest.cpp b/tests/GradientTest.cpp
index cd66a3ee3c..cf8fbee206 100644
--- a/tests/GradientTest.cpp
+++ b/tests/GradientTest.cpp
@@ -146,7 +146,7 @@ static void TestConstantGradient(skiatest::Reporter*) {
outBitmap.allocPixels();
SkPaint paint;
paint.setShader(s.get());
- SkBitmapDevice device(outBitmap);
+ SkDevice device(outBitmap);
SkCanvas canvas(&device);
canvas.drawPaint(paint);
SkAutoLockPixels alp(outBitmap);
diff --git a/tests/LayerDrawLooperTest.cpp b/tests/LayerDrawLooperTest.cpp
index 2e4642e6fe..daadc86e54 100644
--- a/tests/LayerDrawLooperTest.cpp
+++ b/tests/LayerDrawLooperTest.cpp
@@ -19,20 +19,17 @@
namespace {
-class FakeDevice : public SkBitmapDevice {
+class FakeDevice : public SkDevice {
public:
- FakeDevice() : SkBitmapDevice(SkBitmap::kARGB_8888_Config, 100, 100, false) { }
+ FakeDevice() : SkDevice(SkBitmap::kARGB_8888_Config, 100, 100) { }
virtual void drawRect(const SkDraw& draw, const SkRect& r,
const SkPaint& paint) SK_OVERRIDE {
fLastMatrix = *draw.fMatrix;
- INHERITED::drawRect(draw, r, paint);
+ SkDevice::drawRect(draw, r, paint);
}
SkMatrix fLastMatrix;
-
-private:
- typedef SkBitmapDevice INHERITED;
};
} // namespace
diff --git a/tests/PremulAlphaRoundTripTest.cpp b/tests/PremulAlphaRoundTripTest.cpp
index 79b32f91cb..28150d6240 100644
--- a/tests/PremulAlphaRoundTripTest.cpp
+++ b/tests/PremulAlphaRoundTripTest.cpp
@@ -41,7 +41,7 @@ static const SkCanvas::Config8888 gUnpremulConfigs[] = {
};
void PremulAlphaRoundTripTest(skiatest::Reporter* reporter, GrContextFactory* factory) {
- SkAutoTUnref<SkBaseDevice> device;
+ SkAutoTUnref<SkDevice> device;
for (int dtype = 0; dtype < 2; ++dtype) {
int glCtxTypeCnt = 1;
@@ -52,10 +52,10 @@ void PremulAlphaRoundTripTest(skiatest::Reporter* reporter, GrContextFactory* fa
#endif
for (int glCtxType = 0; glCtxType < glCtxTypeCnt; ++glCtxType) {
if (0 == dtype) {
- device.reset(new SkBitmapDevice(SkBitmap::kARGB_8888_Config,
- 256,
- 256,
- false));
+ device.reset(new SkDevice(SkBitmap::kARGB_8888_Config,
+ 256,
+ 256,
+ false));
} else {
#if SK_SUPPORT_GPU
GrContextFactory::GLContextType type =
diff --git a/tests/ReadPixelsTest.cpp b/tests/ReadPixelsTest.cpp
index 9cc10740e8..24f5954efe 100644
--- a/tests/ReadPixelsTest.cpp
+++ b/tests/ReadPixelsTest.cpp
@@ -311,10 +311,9 @@ void ReadPixelsTest(skiatest::Reporter* reporter, GrContextFactory* factory) {
}
#endif
for (int glCtxType = 0; glCtxType < glCtxTypeCnt; ++glCtxType) {
- SkAutoTUnref<SkBaseDevice> device;
+ SkAutoTUnref<SkDevice> device;
if (0 == dtype) {
- device.reset(new SkBitmapDevice(SkBitmap::kARGB_8888_Config,
- DEV_W, DEV_H, false));
+ device.reset(new SkDevice(SkBitmap::kARGB_8888_Config, DEV_W, DEV_H, false));
} else {
#if SK_SUPPORT_GPU
GrContextFactory::GLContextType type =
diff --git a/tests/ReadWriteAlphaTest.cpp b/tests/ReadWriteAlphaTest.cpp
index 8ae936e97b..78306693db 100644
--- a/tests/ReadWriteAlphaTest.cpp
+++ b/tests/ReadWriteAlphaTest.cpp
@@ -82,7 +82,7 @@ static void ReadWriteAlphaTest(skiatest::Reporter* reporter, GrContextFactory* f
REPORTER_ASSERT(reporter, match);
// Now try writing on the single channel texture
- SkAutoTUnref<SkBaseDevice> device(new SkGpuDevice(context, texture->asRenderTarget()));
+ SkAutoTUnref<SkDevice> device(new SkGpuDevice(context, texture->asRenderTarget()));
SkCanvas canvas(device);
SkPaint paint;
diff --git a/tests/TileGridTest.cpp b/tests/TileGridTest.cpp
index f64365227a..f4a0af8c8b 100644
--- a/tests/TileGridTest.cpp
+++ b/tests/TileGridTest.cpp
@@ -24,7 +24,7 @@ enum Tile {
namespace {
class MockCanvas : public SkCanvas {
public:
- MockCanvas(SkBaseDevice* device) : SkCanvas(device)
+ MockCanvas(SkDevice* device) : SkCanvas(device)
{}
virtual void drawRect(const SkRect& rect, const SkPaint&)
@@ -80,14 +80,14 @@ public:
// Test parts of top-left tile
{
- SkBitmapDevice device(store);
+ SkDevice device(store);
MockCanvas mockCanvas(&device);
picture.draw(&mockCanvas);
REPORTER_ASSERT(reporter, 1 == mockCanvas.fRects.count());
REPORTER_ASSERT(reporter, rect1 == mockCanvas.fRects[0]);
}
{
- SkBitmapDevice device(store);
+ SkDevice device(store);
MockCanvas mockCanvas(&device);
mockCanvas.translate(SkFloatToScalar(-7.99f), SkFloatToScalar(-7.99f));
picture.draw(&mockCanvas);
@@ -96,7 +96,7 @@ public:
}
// Corner overlap
{
- SkBitmapDevice device(store);
+ SkDevice device(store);
MockCanvas mockCanvas(&device);
mockCanvas.translate(SkFloatToScalar(-9.5f), SkFloatToScalar(-9.5f));
picture.draw(&mockCanvas);
@@ -106,7 +106,7 @@ public:
}
// Intersect bottom right tile, but does not overlap rect 2
{
- SkBitmapDevice device(store);
+ SkDevice device(store);
MockCanvas mockCanvas(&device);
mockCanvas.translate(SkFloatToScalar(-16.0f), SkFloatToScalar(-16.0f));
picture.draw(&mockCanvas);
@@ -115,7 +115,7 @@ public:
}
// Out of bounds queries, snap to border tiles
{
- SkBitmapDevice device(store);
+ SkDevice device(store);
MockCanvas mockCanvas(&device);
mockCanvas.translate(SkFloatToScalar(2.0f), SkFloatToScalar(0.0f));
picture.draw(&mockCanvas);
@@ -123,7 +123,7 @@ public:
REPORTER_ASSERT(reporter, rect1 == mockCanvas.fRects[0]);
}
{
- SkBitmapDevice device(store);
+ SkDevice device(store);
MockCanvas mockCanvas(&device);
mockCanvas.translate(SkFloatToScalar(0.0f), SkFloatToScalar(2.0f));
picture.draw(&mockCanvas);
@@ -131,7 +131,7 @@ public:
REPORTER_ASSERT(reporter, rect1 == mockCanvas.fRects[0]);
}
{
- SkBitmapDevice device(store);
+ SkDevice device(store);
MockCanvas mockCanvas(&device);
mockCanvas.translate(SkFloatToScalar(-22.0f), SkFloatToScalar(-16.0f));
picture.draw(&mockCanvas);
@@ -139,7 +139,7 @@ public:
REPORTER_ASSERT(reporter, rect2 == mockCanvas.fRects[0]);
}
{
- SkBitmapDevice device(store);
+ SkDevice device(store);
MockCanvas mockCanvas(&device);
mockCanvas.translate(SkFloatToScalar(-16.0f), SkFloatToScalar(-22.0f));
picture.draw(&mockCanvas);
@@ -185,7 +185,7 @@ public:
{
// The offset should cancel the top and left borders of the top left tile
// So a look-up at interval 0-10 should be grid aligned,
- SkBitmapDevice device(tileBitmap);
+ SkDevice device(tileBitmap);
MockCanvas mockCanvas(&device);
picture.draw(&mockCanvas);
REPORTER_ASSERT(reporter, 1 == mockCanvas.fRects.count());
@@ -193,7 +193,7 @@ public:
}
{
// Encroaching border by one pixel
- SkBitmapDevice device(moreThanATileBitmap);
+ SkDevice device(moreThanATileBitmap);
MockCanvas mockCanvas(&device);
picture.draw(&mockCanvas);
REPORTER_ASSERT(reporter, 2 == mockCanvas.fRects.count());
@@ -204,7 +204,7 @@ public:
// Tile stride is 8 (tileWidth - 2 * border pixels
// so translating by 8, should make query grid-aligned
// with middle tile.
- SkBitmapDevice device(tileBitmap);
+ SkDevice device(tileBitmap);
MockCanvas mockCanvas(&device);
mockCanvas.translate(SkIntToScalar(-8), SkIntToScalar(-8));
picture.draw(&mockCanvas);
@@ -212,7 +212,7 @@ public:
REPORTER_ASSERT(reporter, rect2 == mockCanvas.fRects[0]);
}
{
- SkBitmapDevice device(tileBitmap);
+ SkDevice device(tileBitmap);
MockCanvas mockCanvas(&device);
mockCanvas.translate(SkFloatToScalar(-7.9f), SkFloatToScalar(-7.9f));
picture.draw(&mockCanvas);
@@ -221,7 +221,7 @@ public:
REPORTER_ASSERT(reporter, rect2 == mockCanvas.fRects[1]);
}
{
- SkBitmapDevice device(tileBitmap);
+ SkDevice device(tileBitmap);
MockCanvas mockCanvas(&device);
mockCanvas.translate(SkFloatToScalar(-8.1f), SkFloatToScalar(-8.1f));
picture.draw(&mockCanvas);
@@ -233,7 +233,7 @@ public:
// Regression test for crbug.com/234688
// Once the 2x2 device region is inset by margin, it yields an empty
// adjusted region, sitting right on top of the tile boundary.
- SkBitmapDevice device(tinyBitmap);
+ SkDevice device(tinyBitmap);
MockCanvas mockCanvas(&device);
mockCanvas.translate(SkFloatToScalar(-8.0f), SkFloatToScalar(-8.0f));
picture.draw(&mockCanvas);
diff --git a/tests/WritePixelsTest.cpp b/tests/WritePixelsTest.cpp
index 3db3a2abe3..202bfd6abf 100644
--- a/tests/WritePixelsTest.cpp
+++ b/tests/WritePixelsTest.cpp
@@ -227,7 +227,7 @@ bool checkWrite(skiatest::Reporter* reporter,
const SkBitmap& bitmap,
int writeX, int writeY,
SkCanvas::Config8888 config8888) {
- SkBaseDevice* dev = canvas->getDevice();
+ SkDevice* dev = canvas->getDevice();
if (!dev) {
return false;
}
@@ -305,7 +305,7 @@ static const CanvasConfig gCanvasConfigs[] = {
#endif
};
-SkBaseDevice* createDevice(const CanvasConfig& c, GrContext* grCtx) {
+SkDevice* createDevice(const CanvasConfig& c, GrContext* grCtx) {
switch (c.fDevType) {
case kRaster_DevType: {
SkBitmap bmp;
@@ -320,7 +320,7 @@ SkBaseDevice* createDevice(const CanvasConfig& c, GrContext* grCtx) {
SkAutoLockPixels alp(bmp);
memset(bmp.getPixels(), DEV_PAD, bmp.getSafeSize());
}
- return new SkBitmapDevice(bmp);
+ return new SkDevice(bmp);
}
#if SK_SUPPORT_GPU
case kGpu_BottomLeft_DevType:
@@ -435,7 +435,7 @@ void WritePixelsTest(skiatest::Reporter* reporter, GrContextFactory* factory) {
}
#endif
- SkAutoTUnref<SkBaseDevice> device(createDevice(gCanvasConfigs[i], context));
+ SkAutoTUnref<SkDevice> device(createDevice(gCanvasConfigs[i], context));
SkCanvas canvas(device);
static const SkCanvas::Config8888 gSrcConfigs[] = {