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

Side by Side Diff: skia/ext/bitmap_platform_device_cairo.h

Issue 1839113002: Limit manual control of platform painting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef SKIA_EXT_BITMAP_PLATFORM_DEVICE_CAIRO_H_ 5 #ifndef SKIA_EXT_BITMAP_PLATFORM_DEVICE_CAIRO_H_
6 #define SKIA_EXT_BITMAP_PLATFORM_DEVICE_CAIRO_H_ 6 #define SKIA_EXT_BITMAP_PLATFORM_DEVICE_CAIRO_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "skia/ext/platform_canvas.h"
f(malita) 2016/03/29 17:31:07 Nit: forward-declare ScopedPlatformPaint instead o
tomhudson 2016/03/29 17:47:31 Ugh, I had problems with that when I was declaring
13 #include "skia/ext/platform_device.h" 14 #include "skia/ext/platform_device.h"
14 15
15 typedef struct _cairo_surface cairo_surface_t; 16 typedef struct _cairo_surface cairo_surface_t;
16 17
17 // ----------------------------------------------------------------------------- 18 // -----------------------------------------------------------------------------
18 // Image byte ordering on Linux: 19 // Image byte ordering on Linux:
19 // 20 //
20 // Pixels are packed into 32-bit words these days. Even for 24-bit images, 21 // Pixels are packed into 32-bit words these days. Even for 24-bit images,
21 // often 8-bits will be left unused for alignment reasons. Thus, when you see 22 // often 8-bits will be left unused for alignment reasons. Thus, when you see
22 // ARGB as the byte order you have to wonder if that's in memory order or 23 // ARGB as the byte order you have to wonder if that's in memory order or
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 // This doesn't take ownership of |data|. If |data| is NULL, the contents 78 // This doesn't take ownership of |data|. If |data| is NULL, the contents
78 // of the device are initialized to 0. 79 // of the device are initialized to 0.
79 static BitmapPlatformDevice* Create(int width, int height, bool is_opaque, 80 static BitmapPlatformDevice* Create(int width, int height, bool is_opaque,
80 uint8_t* data); 81 uint8_t* data);
81 82
82 // Overridden from SkBaseDevice: 83 // Overridden from SkBaseDevice:
83 void setMatrixClip(const SkMatrix& transform, 84 void setMatrixClip(const SkMatrix& transform,
84 const SkRegion& region, 85 const SkRegion& region,
85 const SkClipStack&) override; 86 const SkClipStack&) override;
86 87
88 protected:
87 // Overridden from PlatformDevice: 89 // Overridden from PlatformDevice:
88 cairo_t* BeginPlatformPaint() override; 90 cairo_t* BeginPlatformPaint() override;
f(malita) 2016/03/29 17:31:07 Nit: if this is only called from ScopedPlatformPai
tomhudson 2016/03/29 17:47:31 Done.
89 91
90 protected:
91 SkBaseDevice* onCreateDevice(const CreateInfo&, const SkPaint*) override; 92 SkBaseDevice* onCreateDevice(const CreateInfo&, const SkPaint*) override;
92 93
93 private: 94 private:
94 static BitmapPlatformDevice* Create(int width, int height, bool is_opaque, 95 static BitmapPlatformDevice* Create(int width, int height, bool is_opaque,
95 cairo_surface_t* surface); 96 cairo_surface_t* surface);
96 97
97 // Sets the transform and clip operations. This will not update the Cairo 98 // Sets the transform and clip operations. This will not update the Cairo
98 // context, but will mark the config as dirty. The next call of LoadConfig 99 // context, but will mark the config as dirty. The next call of LoadConfig
99 // will pick up these changes. 100 // will pick up these changes.
100 void SetMatrixClip(const SkMatrix& transform, const SkRegion& region); 101 void SetMatrixClip(const SkMatrix& transform, const SkRegion& region);
(...skipping 11 matching lines...) Expand all
112 bool config_dirty_; 113 bool config_dirty_;
113 114
114 // Translation assigned to the context: we need to keep track of this 115 // Translation assigned to the context: we need to keep track of this
115 // separately so it can be updated even if the context isn't created yet. 116 // separately so it can be updated even if the context isn't created yet.
116 SkMatrix transform_; 117 SkMatrix transform_;
117 118
118 // The current clipping 119 // The current clipping
119 SkRegion clip_region_; 120 SkRegion clip_region_;
120 121
121 DISALLOW_COPY_AND_ASSIGN(BitmapPlatformDevice); 122 DISALLOW_COPY_AND_ASSIGN(BitmapPlatformDevice);
123 friend class skia::ScopedPlatformPaint;
f(malita) 2016/03/29 17:31:07 Nit: we're in the 'skia' namespace, I don't think
tomhudson 2016/03/29 17:47:31 Done.
122 }; 124 };
123 125
124 } // namespace skia 126 } // namespace skia
125 127
126 #endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_CAIRO_H_ 128 #endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_CAIRO_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698