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

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

Issue 22796028: Updating Chromium to Skia SkBaseDevice/SkBitmapDevice split (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added TODOs Created 7 years, 3 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
« no previous file with comments | « printing/pdf_metafile_skia.cc ('k') | skia/ext/analysis_canvas.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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_ANALYSIS_CANVAS_H_ 5 #ifndef SKIA_EXT_ANALYSIS_CANVAS_H_
6 #define SKIA_EXT_ANALYSIS_CANVAS_H_ 6 #define SKIA_EXT_ANALYSIS_CANVAS_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "third_party/skia/include/core/SkBitmapDevice.h"
9 #include "third_party/skia/include/core/SkCanvas.h" 10 #include "third_party/skia/include/core/SkCanvas.h"
10 #include "third_party/skia/include/core/SkDevice.h"
11 #include "third_party/skia/include/core/SkPicture.h" 11 #include "third_party/skia/include/core/SkPicture.h"
12 12
13 namespace skia { 13 namespace skia {
14 14
15 class AnalysisDevice; 15 class AnalysisDevice;
16 16
17 // Does not render anything, but gathers statistics about a region 17 // Does not render anything, but gathers statistics about a region
18 // (specified as a clip rectangle) of an SkPicture as the picture is 18 // (specified as a clip rectangle) of an SkPicture as the picture is
19 // played back through it. 19 // played back through it.
20 // To use: create a SkBitmap with kNo_Config, create an AnalysisDevice 20 // To use: create a SkBitmap with kNo_Config, create an AnalysisDevice
(...skipping 30 matching lines...) Expand all
51 virtual void restore() OVERRIDE; 51 virtual void restore() OVERRIDE;
52 52
53 private: 53 private:
54 typedef SkCanvas INHERITED; 54 typedef SkCanvas INHERITED;
55 55
56 int saved_stack_size_; 56 int saved_stack_size_;
57 int force_not_solid_stack_level_; 57 int force_not_solid_stack_level_;
58 int force_not_transparent_stack_level_; 58 int force_not_transparent_stack_level_;
59 }; 59 };
60 60
61 class SK_API AnalysisDevice : public SkDevice { 61 // TODO(robertphillips): Once Skia's SkBaseDevice API is refactored to
62 // remove the bitmap-specific entry points, it might make sense for this
63 // to be derived from SkBaseDevice (rather than SkBitmapDevice)
64 class SK_API AnalysisDevice : public SkBitmapDevice {
62 public: 65 public:
63 AnalysisDevice(const SkBitmap& bitmap); 66 AnalysisDevice(const SkBitmap& bitmap);
64 virtual ~AnalysisDevice(); 67 virtual ~AnalysisDevice();
65 68
66 bool GetColorIfSolid(SkColor* color) const; 69 bool GetColorIfSolid(SkColor* color) const;
67 bool HasText() const; 70 bool HasText() const;
68 71
69 void SetForceNotSolid(bool flag); 72 void SetForceNotSolid(bool flag);
70 void SetForceNotTransparent(bool flag); 73 void SetForceNotTransparent(bool flag);
71 74
72 protected: 75 protected:
73 // SkDevice overrides. 76 // SkBaseDevice overrides.
74 virtual void clear(SkColor color) OVERRIDE; 77 virtual void clear(SkColor color) OVERRIDE;
75 virtual void drawPaint(const SkDraw& draw, const SkPaint& paint) OVERRIDE; 78 virtual void drawPaint(const SkDraw& draw, const SkPaint& paint) OVERRIDE;
76 virtual void drawPoints(const SkDraw& draw, 79 virtual void drawPoints(const SkDraw& draw,
77 SkCanvas::PointMode mode, 80 SkCanvas::PointMode mode,
78 size_t count, 81 size_t count,
79 const SkPoint points[], 82 const SkPoint points[],
80 const SkPaint& paint) OVERRIDE; 83 const SkPaint& paint) OVERRIDE;
81 virtual void drawRect(const SkDraw& draw, 84 virtual void drawRect(const SkDraw& draw,
82 const SkRect& rect, 85 const SkRect& rect,
83 const SkPaint& paint) OVERRIDE; 86 const SkPaint& paint) OVERRIDE;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 SkCanvas::VertexMode vertex_mode, 139 SkCanvas::VertexMode vertex_mode,
137 int vertex_count, 140 int vertex_count,
138 const SkPoint verts[], 141 const SkPoint verts[],
139 const SkPoint texs[], 142 const SkPoint texs[],
140 const SkColor colors[], 143 const SkColor colors[],
141 SkXfermode* xmode, 144 SkXfermode* xmode,
142 const uint16_t indices[], 145 const uint16_t indices[],
143 int index_count, 146 int index_count,
144 const SkPaint& paint) OVERRIDE; 147 const SkPaint& paint) OVERRIDE;
145 virtual void drawDevice(const SkDraw& draw, 148 virtual void drawDevice(const SkDraw& draw,
146 SkDevice* device, 149 SkBaseDevice* device,
147 int x, 150 int x,
148 int y, 151 int y,
149 const SkPaint& paint) OVERRIDE; 152 const SkPaint& paint) OVERRIDE;
150 153
151 private: 154 private:
152 typedef SkDevice INHERITED; 155 typedef SkBitmapDevice INHERITED;
153 156
154 bool is_forced_not_solid_; 157 bool is_forced_not_solid_;
155 bool is_forced_not_transparent_; 158 bool is_forced_not_transparent_;
156 bool is_solid_color_; 159 bool is_solid_color_;
157 SkColor color_; 160 SkColor color_;
158 bool is_transparent_; 161 bool is_transparent_;
159 bool has_text_; 162 bool has_text_;
160 }; 163 };
161 164
162 } // namespace skia 165 } // namespace skia
163 166
164 #endif // SKIA_EXT_ANALYSIS_CANVAS_H_ 167 #endif // SKIA_EXT_ANALYSIS_CANVAS_H_
165 168
OLDNEW
« no previous file with comments | « printing/pdf_metafile_skia.cc ('k') | skia/ext/analysis_canvas.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698