Make PixelRefUtils::GatherDiscardablePixelRefs use Skia's version of the NoSaveLayerCanvas

This is just intended to reduce some code duplication and allow increased velocity on altering the SkCanvas API

Review URL: https://codereview.chromium.org/199043004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@260204 0039d316-1c4b-4281-b951-d872f2087c98
parent 8b77c2ad
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "third_party/skia/include/core/SkRRect.h" #include "third_party/skia/include/core/SkRRect.h"
#include "third_party/skia/include/core/SkRect.h" #include "third_party/skia/include/core/SkRect.h"
#include "third_party/skia/include/core/SkShader.h" #include "third_party/skia/include/core/SkShader.h"
#include "third_party/skia/include/utils/SkNoSaveLayerCanvas.h"
#include "third_party/skia/src/core/SkRasterClip.h" #include "third_party/skia/src/core/SkRasterClip.h"
namespace skia { namespace skia {
...@@ -360,42 +361,6 @@ class GatherPixelRefDevice : public SkBitmapDevice { ...@@ -360,42 +361,6 @@ class GatherPixelRefDevice : public SkBitmapDevice {
} }
}; };
class NoSaveLayerCanvas : public SkCanvas {
public:
NoSaveLayerCanvas(SkBaseDevice* device) : INHERITED(device) {}
protected:
// Turn saveLayer() into save() for speed, should not affect correctness.
virtual SaveLayerStrategy willSaveLayer(const SkRect* bounds,
const SkPaint* paint,
SaveFlags flags) SK_OVERRIDE {
this->INHERITED::willSaveLayer(bounds, paint, flags);
return kNoLayer_SaveLayerStrategy;
}
// Disable aa for speed.
virtual void onClipRect(const SkRect& rect,
SkRegion::Op op,
ClipEdgeStyle edge_style) SK_OVERRIDE {
this->INHERITED::onClipRect(rect, op, kHard_ClipEdgeStyle);
}
virtual void onClipPath(const SkPath& path,
SkRegion::Op op,
ClipEdgeStyle edge_style) SK_OVERRIDE {
this->updateClipConservativelyUsingBounds(path.getBounds(), op,
path.isInverseFillType());
}
virtual void onClipRRect(const SkRRect& rrect,
SkRegion::Op op,
ClipEdgeStyle edge_style) SK_OVERRIDE {
this->updateClipConservativelyUsingBounds(rrect.getBounds(), op, false);
}
private:
typedef SkCanvas INHERITED;
};
} // namespace } // namespace
void PixelRefUtils::GatherDiscardablePixelRefs( void PixelRefUtils::GatherDiscardablePixelRefs(
...@@ -409,7 +374,7 @@ void PixelRefUtils::GatherDiscardablePixelRefs( ...@@ -409,7 +374,7 @@ void PixelRefUtils::GatherDiscardablePixelRefs(
SkBitmap::kNo_Config, picture->width(), picture->height()); SkBitmap::kNo_Config, picture->width(), picture->height());
GatherPixelRefDevice device(empty_bitmap, &pixel_ref_set); GatherPixelRefDevice device(empty_bitmap, &pixel_ref_set);
NoSaveLayerCanvas canvas(&device); SkNoSaveLayerCanvas canvas(&device);
canvas.clipRect(SkRect::MakeWH(picture->width(), picture->height()), canvas.clipRect(SkRect::MakeWH(picture->width(), picture->height()),
SkRegion::kIntersect_Op, SkRegion::kIntersect_Op,
......
...@@ -70,6 +70,7 @@ ...@@ -70,6 +70,7 @@
'../third_party/skia/include/utils/mac/SkCGUtils.h', '../third_party/skia/include/utils/mac/SkCGUtils.h',
'../third_party/skia/include/utils/SkDeferredCanvas.h', '../third_party/skia/include/utils/SkDeferredCanvas.h',
'../third_party/skia/include/utils/SkMatrix44.h', '../third_party/skia/include/utils/SkMatrix44.h',
'../third_party/skia/include/utils/SkNoSaveLayerCanvas.h',
'../third_party/skia/src/utils/debugger/SkDebugCanvas.cpp', '../third_party/skia/src/utils/debugger/SkDebugCanvas.cpp',
'../third_party/skia/src/utils/debugger/SkDebugCanvas.h', '../third_party/skia/src/utils/debugger/SkDebugCanvas.h',
'../third_party/skia/src/utils/debugger/SkDrawCommand.cpp', '../third_party/skia/src/utils/debugger/SkDrawCommand.cpp',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment