Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / skia / src / utils / SkPictureUtils.cpp
index 92d0487..85d523f 100644 (file)
@@ -54,16 +54,12 @@ public:
 
     GatherPixelRefDevice(int width, int height, PixelRefSet* prset) {
         fSize.set(width, height);
-        fEmptyBitmap.setConfig(SkBitmap::kNo_Config, width, height);
+        fEmptyBitmap.setInfo(SkImageInfo::MakeUnknown(width, height));
         fPRSet = prset;
     }
 
-    virtual uint32_t getDeviceCapabilities() SK_OVERRIDE { return 0; }
-    virtual int width() const SK_OVERRIDE { return fSize.width(); }
-    virtual int height() const SK_OVERRIDE { return fSize.height(); }
-    virtual bool isOpaque() const SK_OVERRIDE { return false; }
-    virtual SkBitmap::Config config() const SK_OVERRIDE {
-        return SkBitmap::kNo_Config;
+    virtual SkImageInfo imageInfo() const SK_OVERRIDE {
+        return SkImageInfo::MakeUnknown(fSize.width(), fSize.height());
     }
     virtual GrRenderTarget* accessRenderTarget() SK_OVERRIDE { return NULL; }
     virtual bool filterTextFlags(const SkPaint& paint, TextFlags*) SK_OVERRIDE {
@@ -77,7 +73,7 @@ public:
     virtual void unlockPixels() SK_OVERRIDE { nothing_to_do(); }
     virtual bool allowImageFilter(const SkImageFilter*) SK_OVERRIDE { return false; }
     virtual bool canHandleImageFilter(const SkImageFilter*) SK_OVERRIDE { return false; }
-    virtual bool filterImage(const SkImageFilter*, const SkBitmap&, const SkMatrix&,
+    virtual bool filterImage(const SkImageFilter*, const SkBitmap&, const SkImageFilter::Context&,
                              SkBitmap* result, SkIPoint* offset) SK_OVERRIDE {
         return false;
     }
@@ -85,10 +81,6 @@ public:
     virtual void clear(SkColor color) SK_OVERRIDE {
         nothing_to_do();
     }
-    virtual void writePixels(const SkBitmap& bitmap, int x, int y,
-                             SkCanvas::Config8888 config8888) SK_OVERRIDE {
-        not_supported();
-    }
 
     virtual void drawPaint(const SkDraw&, const SkPaint& paint) SK_OVERRIDE {
         this->addBitmapFromPaint(paint);
@@ -117,7 +109,7 @@ public:
     virtual void drawBitmap(const SkDraw&, const SkBitmap& bitmap,
                             const SkMatrix&, const SkPaint& paint) SK_OVERRIDE {
         this->addBitmap(bitmap);
-        if (SkBitmap::kA8_Config == bitmap.config()) {
+        if (kAlpha_8_SkColorType == bitmap.colorType()) {
             this->addBitmapFromPaint(paint);
         }
     }
@@ -126,7 +118,7 @@ public:
                                 const SkPaint& paint,
                                 SkCanvas::DrawBitmapRectFlags flags) SK_OVERRIDE {
         this->addBitmap(bitmap);
-        if (SkBitmap::kA8_Config == bitmap.config()) {
+        if (kAlpha_8_SkColorType == bitmap.colorType()) {
             this->addBitmapFromPaint(paint);
         }
     }
@@ -162,23 +154,13 @@ public:
     }
 
 protected:
-    virtual bool onReadPixels(const SkBitmap& bitmap,
-                              int x, int y,
-                              SkCanvas::Config8888 config8888) SK_OVERRIDE {
-        not_supported();
-        return false;
-    }
-
     virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) SK_OVERRIDE {
         not_supported();
     }
-    virtual SkBaseDevice* onCreateCompatibleDevice(SkBitmap::Config config,
-                                                   int width, int height,
-                                                   bool isOpaque,
-                                                   Usage usage) SK_OVERRIDE {
+    virtual SkBaseDevice* onCreateDevice(const SkImageInfo& info, Usage usage) SK_OVERRIDE {
         // we expect to only get called via savelayer, in which case it is fine.
         SkASSERT(kSaveLayer_Usage == usage);
-        return SkNEW_ARGS(GatherPixelRefDevice, (width, height, fPRSet));
+        return SkNEW_ARGS(GatherPixelRefDevice, (info.width(), info.height(), fPRSet));
     }
     virtual void flush() SK_OVERRIDE {}
 
@@ -208,7 +190,7 @@ private:
     typedef SkBaseDevice INHERITED;
 };
 
-SkData* SkPictureUtils::GatherPixelRefs(SkPicture* pict, const SkRect& area) {
+SkData* SkPictureUtils::GatherPixelRefs(const SkPicture* pict, const SkRect& area) {
     if (NULL == pict) {
         return NULL;
     }
@@ -227,7 +209,7 @@ SkData* SkPictureUtils::GatherPixelRefs(SkPicture* pict, const SkRect& area) {
     SkNoSaveLayerCanvas canvas(&device);
 
     canvas.clipRect(area, SkRegion::kIntersect_Op, false);
-    canvas.drawPicture(*pict);
+    canvas.drawPicture(pict);
 
     SkData* data = NULL;
     int count = array.count();