merge with changes for GPU backend
git-svn-id: http://skia.googlecode.com/svn/trunk@637 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index cc65413..9aefd0a 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -118,16 +118,23 @@
////////////////////////////////////////////////////////////////////////////////
-SkDevice* SkPDFDeviceFactory::newDevice(SkBitmap::Config config,
- int width, int height,
- bool isOpaque, bool isForLayer) {
+SkDevice* SkPDFDeviceFactory::newDevice(SkCanvas*, SkBitmap::Config config,
+ int width, int height, bool isOpaque,
+ bool /*isForLayer*/) {
return SkNEW_ARGS(SkPDFDevice, (width, height));
}
+static inline SkBitmap makeABitmap(int width, int height) {
+ SkBitmap bitmap;
+ bitmap.setConfig(SkBitmap::kNo_Config, width, height);
+ return bitmap;
+}
+
SkPDFDevice::SkPDFDevice(int width, int height)
: fWidth(width),
fHeight(height),
- fGraphicStackIndex(0) {
+ fGraphicStackIndex(0),
+ SkDevice(NULL, makeABitmap(width, height), false) {
fGraphicStack[0].fColor = SK_ColorBLACK;
fGraphicStack[0].fTextSize = SK_ScalarNaN; // This has no default value.
fGraphicStack[0].fTextScaleX = SK_Scalar1;
@@ -271,7 +278,10 @@
}
void SkPDFDevice::drawBitmap(const SkDraw&, const SkBitmap& bitmap,
+ const SkIRect* srcRect,
const SkMatrix& matrix, const SkPaint& paint) {
+ // TODO: respect srcRect if present
+
SkMatrix transform = matrix;
transform.postConcat(fGraphicStack[fGraphicStackIndex].fTransform);
internalDrawBitmap(transform, bitmap, paint);