Index: ui/gfx/canvas.h |
diff --git a/ui/gfx/canvas.h b/ui/gfx/canvas.h |
index 4fcb4bcfbdfe563610198d12239de0f6e12ec6e4..29120504e441c45d142b7378521bab37bcbfccbc 100644 |
--- a/ui/gfx/canvas.h |
+++ b/ui/gfx/canvas.h |
@@ -11,10 +11,11 @@ |
#include <vector> |
#include "base/macros.h" |
+#include "base/optional.h" |
#include "base/strings/string16.h" |
#include "cc/paint/paint_canvas.h" |
#include "cc/paint/paint_flags.h" |
-#include "cc/paint/paint_surface.h" |
+#include "cc/paint/skia_paint_canvas.h" |
#include "ui/gfx/image/image_skia.h" |
#include "ui/gfx/native_widget_types.h" |
#include "ui/gfx/text_constants.h" |
@@ -475,6 +476,10 @@ class GFX_EXPORT Canvas { |
// TODO(enne): rename sk_canvas members and interface. |
cc::PaintCanvas* sk_canvas() { return canvas_; } |
+ SkBitmap& get_bitmap() { |
enne (OOO)
2017/03/21 00:46:38
Maybe ToBitmap() should return bitmap_ if it exist
vmpstr
2017/03/21 17:47:12
Oh, I completely missed that there is ToBitmap her
enne (OOO)
2017/03/21 17:51:02
Oh, even better! If that's always the case, then l
|
+ DCHECK(bitmap_); |
+ return bitmap_.value(); |
+ } |
float image_scale() const { return image_scale_; } |
private: |
@@ -496,6 +501,7 @@ class GFX_EXPORT Canvas { |
bool filter, |
const cc::PaintFlags& flags, |
bool remove_image_scale); |
+ cc::PaintCanvas* CreateOwnedCanvas(const Size& size, bool is_opaque); |
// The device scale factor at which drawing on this canvas occurs. |
// An additional scale can be applied via Canvas::Scale(). However, |
@@ -503,10 +509,11 @@ class GFX_EXPORT Canvas { |
float image_scale_; |
// canvas_ is our active canvas object. Sometimes we are also the owner, |
- // in which case surface_ will be set. Other times we are just |
- // borrowing someone else's canvas, in which case canvas_ will point there |
- // but surface_ will be null. |
- sk_sp<cc::PaintSurface> surface_; |
+ // in which case bitmap_ and owned_canvas_ will be set. Other times we are |
+ // just borrowing someone else's canvas, in which case canvas_ will point |
+ // there but bitmap_ and owned_canvas_ will not exist. |
+ base::Optional<SkBitmap> bitmap_; |
+ base::Optional<cc::SkiaPaintCanvas> owned_canvas_; |
cc::PaintCanvas* canvas_; |
DISALLOW_COPY_AND_ASSIGN(Canvas); |