Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3960)

Unified Diff: cc/paint/paint_canvas.cc

Issue 2739533003: Revert of Make cc/paint have concrete types (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/paint/paint_canvas.h ('k') | cc/paint/paint_flags.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/paint/paint_canvas.cc
diff --git a/cc/paint/paint_canvas.cc b/cc/paint/paint_canvas.cc
index d3a8b57183aaa11d888aa959082ba32372fd8f56..53dab8fb45b7afb25ce32b72bb3915e02cf6df39 100644
--- a/cc/paint/paint_canvas.cc
+++ b/cc/paint/paint_canvas.cc
@@ -4,12 +4,7 @@
#include "cc/paint/paint_canvas.h"
-#include "base/memory/ptr_util.h"
-#include "cc/paint/paint_record.h"
-#include "cc/paint/paint_recorder.h"
-#include "third_party/skia/include/core/SkAnnotation.h"
#include "third_party/skia/include/core/SkMetaData.h"
-#include "third_party/skia/include/utils/SkNWayCanvas.h"
#if defined(OS_MACOSX)
namespace {
@@ -19,20 +14,25 @@
namespace cc {
-PaintCanvas::PaintCanvas(SkCanvas* canvas) : canvas_(canvas) {}
+PaintCanvasPassThrough::PaintCanvasPassThrough(SkCanvas* canvas)
+ : SkNWayCanvas(canvas->getBaseLayerSize().width(),
+ canvas->getBaseLayerSize().height()) {
+ SkIRect raster_bounds;
+ canvas->getDeviceClipBounds(&raster_bounds);
+ clipRect(SkRect::MakeFromIRect(raster_bounds));
+ setMatrix(canvas->getTotalMatrix());
+ addCanvas(canvas);
+}
-PaintCanvas::PaintCanvas(const SkBitmap& bitmap)
- : canvas_(new SkCanvas(bitmap)), owned_(canvas_) {}
+PaintCanvasPassThrough::PaintCanvasPassThrough(int width, int height)
+ : SkNWayCanvas(width, height) {}
-PaintCanvas::PaintCanvas(const SkBitmap& bitmap, const SkSurfaceProps& props)
- : canvas_(new SkCanvas(bitmap, props)), owned_(canvas_) {}
-
-PaintCanvas::~PaintCanvas() = default;
+PaintCanvasPassThrough::~PaintCanvasPassThrough() = default;
bool ToPixmap(PaintCanvas* canvas, SkPixmap* output) {
SkImageInfo info;
size_t row_bytes;
- void* pixels = canvas->canvas_->accessTopLayerPixels(&info, &row_bytes);
+ void* pixels = canvas->accessTopLayerPixels(&info, &row_bytes);
if (!pixels) {
output->reset();
return false;
@@ -57,22 +57,4 @@
}
#endif
-void PaintCanvasAnnotateRectWithURL(PaintCanvas* canvas,
- const SkRect& rect,
- SkData* data) {
- SkAnnotateRectWithURL(canvas->canvas_, rect, data);
-}
-
-void PaintCanvasAnnotateNamedDestination(PaintCanvas* canvas,
- const SkPoint& point,
- SkData* data) {
- SkAnnotateNamedDestination(canvas->canvas_, point, data);
-}
-
-void PaintCanvasAnnotateLinkToDestination(PaintCanvas* canvas,
- const SkRect& rect,
- SkData* data) {
- SkAnnotateLinkToDestination(canvas->canvas_, rect, data);
-}
-
} // namespace cc
« no previous file with comments | « cc/paint/paint_canvas.h ('k') | cc/paint/paint_flags.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698