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

Unified Diff: ui/gfx/canvas.h

Issue 2758413002: cc/paint: Remove PaintCanvas::peekPixels. (Closed)
Patch Set: canvas 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 | « content/renderer/media/webrtc/webrtc_video_capturer_adapter.cc ('k') | ui/gfx/canvas.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « content/renderer/media/webrtc/webrtc_video_capturer_adapter.cc ('k') | ui/gfx/canvas.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698