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

Side by Side Diff: Source/core/html/canvas/CanvasRenderingContext2D.h

Issue 181693006: Refactoring source image usage in CanvasRenderingContext2D (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2009, 2010, 2011, 2012 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2009, 2010, 2011, 2012 Apple Inc. All rights reserv ed.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 28 matching lines...) Expand all
39 #include "platform/graphics/Path.h" 39 #include "platform/graphics/Path.h"
40 #include "platform/transforms/AffineTransform.h" 40 #include "platform/transforms/AffineTransform.h"
41 #include "wtf/HashMap.h" 41 #include "wtf/HashMap.h"
42 #include "wtf/Vector.h" 42 #include "wtf/Vector.h"
43 #include "wtf/text/WTFString.h" 43 #include "wtf/text/WTFString.h"
44 44
45 namespace blink { class WebLayer; } 45 namespace blink { class WebLayer; }
46 46
47 namespace WebCore { 47 namespace WebCore {
48 48
49 class CanvasImageSource;
49 class CanvasGradient; 50 class CanvasGradient;
50 class CanvasPattern; 51 class CanvasPattern;
51 class CanvasStyle; 52 class CanvasStyle;
52 class DOMPath; 53 class DOMPath;
53 class Element; 54 class Element;
54 class ExceptionState; 55 class ExceptionState;
55 class FloatRect; 56 class FloatRect;
56 class GraphicsContext; 57 class GraphicsContext;
57 class HTMLCanvasElement; 58 class HTMLCanvasElement;
58 class HTMLImageElement; 59 class HTMLImageElement;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 void setShadow(float width, float height, float blur); 165 void setShadow(float width, float height, float blur);
165 void setShadow(float width, float height, float blur, const String& color); 166 void setShadow(float width, float height, float blur, const String& color);
166 void setShadow(float width, float height, float blur, float grayLevel); 167 void setShadow(float width, float height, float blur, float grayLevel);
167 void setShadow(float width, float height, float blur, const String& color, f loat alpha); 168 void setShadow(float width, float height, float blur, const String& color, f loat alpha);
168 void setShadow(float width, float height, float blur, float grayLevel, float alpha); 169 void setShadow(float width, float height, float blur, float grayLevel, float alpha);
169 void setShadow(float width, float height, float blur, float r, float g, floa t b, float a); 170 void setShadow(float width, float height, float blur, float r, float g, floa t b, float a);
170 void setShadow(float width, float height, float blur, float c, float m, floa t y, float k, float a); 171 void setShadow(float width, float height, float blur, float c, float m, floa t y, float k, float a);
171 172
172 void clearShadow(); 173 void clearShadow();
173 174
174 void drawImage(ImageBitmap*, float x, float y, ExceptionState&); 175 void drawImage(CanvasImageSource*, float x, float y, ExceptionState&);
175 void drawImage(ImageBitmap*, float x, float y, float width, float height, Ex ceptionState&); 176 void drawImage(CanvasImageSource*, float x, float y, float width, float heig ht, ExceptionState&);
176 void drawImage(ImageBitmap*, float sx, float sy, float sw, float sh, float d x, float dy, float dw, float dh, ExceptionState&); 177 void drawImage(CanvasImageSource*, float sx, float sy, float sw, float sh, f loat dx, float dy, float dw, float dh, ExceptionState&);
177 void drawImage(HTMLImageElement*, float x, float y, ExceptionState&); 178 void drawImage(CanvasImageSource*, const FloatRect& srcRect, const FloatRect & dstRect, ExceptionState&);
178 void drawImage(HTMLImageElement*, float x, float y, float width, float heigh t, ExceptionState&);
179 void drawImage(HTMLImageElement*, float sx, float sy, float sw, float sh, fl oat dx, float dy, float dw, float dh, ExceptionState&);
180 void drawImage(HTMLImageElement*, const FloatRect& srcRect, const FloatRect& dstRect, ExceptionState&);
181 void drawImage(HTMLImageElement*, const FloatRect& srcRect, const FloatRect& dstRect, const CompositeOperator&, const blink::WebBlendMode&, ExceptionState&) ;
182 void drawImage(HTMLCanvasElement*, float x, float y, ExceptionState&);
183 void drawImage(HTMLCanvasElement*, float x, float y, float width, float heig ht, ExceptionState&);
184 void drawImage(HTMLCanvasElement*, float sx, float sy, float sw, float sh, f loat dx, float dy, float dw, float dh, ExceptionState&);
185 void drawImage(HTMLCanvasElement*, const FloatRect& srcRect, const FloatRect & dstRect, ExceptionState&);
186 void drawImage(HTMLVideoElement*, float x, float y, ExceptionState&);
187 void drawImage(HTMLVideoElement*, float x, float y, float width, float heigh t, ExceptionState&);
188 void drawImage(HTMLVideoElement*, float sx, float sy, float sw, float sh, fl oat dx, float dy, float dw, float dh, ExceptionState&);
189 void drawImage(HTMLVideoElement*, const FloatRect& srcRect, const FloatRect& dstRect, ExceptionState&);
190 179
191 void drawImageFromRect(HTMLImageElement*, float sx = 0, float sy = 0, float sw = 0, float sh = 0, 180 void drawImageFromRect(HTMLImageElement*, float sx = 0, float sy = 0, float sw = 0, float sh = 0,
192 float dx = 0, float dy = 0, float dw = 0, float dh = 0, const String& compositeOperation = emptyString()); 181 float dx = 0, float dy = 0, float dw = 0, float dh = 0, const String& compositeOperation = emptyString());
193 182
194 void setAlpha(float); 183 void setAlpha(float);
195 184
196 void setCompositeOperation(const String&); 185 void setCompositeOperation(const String&);
197 186
198 PassRefPtr<CanvasGradient> createLinearGradient(float x0, float y0, float x1 , float y1, ExceptionState&); 187 PassRefPtr<CanvasGradient> createLinearGradient(float x0, float y0, float x1 , float y1, ExceptionState&);
199 PassRefPtr<CanvasGradient> createRadialGradient(float x0, float y0, float r0 , float x1, float y1, float r1, ExceptionState&); 188 PassRefPtr<CanvasGradient> createRadialGradient(float x0, float y0, float r0 , float x1, float y1, float r1, ExceptionState&);
200 PassRefPtr<CanvasPattern> createPattern(HTMLImageElement*, const String& rep etitionType, ExceptionState&); 189 PassRefPtr<CanvasPattern> createPattern(CanvasImageSource*, const String& re petitionType, ExceptionState&);
201 PassRefPtr<CanvasPattern> createPattern(HTMLCanvasElement*, const String& re petitionType, ExceptionState&);
202 190
203 PassRefPtr<ImageData> createImageData(PassRefPtr<ImageData>, ExceptionState& ) const; 191 PassRefPtr<ImageData> createImageData(PassRefPtr<ImageData>, ExceptionState& ) const;
204 PassRefPtr<ImageData> createImageData(float width, float height, ExceptionSt ate&) const; 192 PassRefPtr<ImageData> createImageData(float width, float height, ExceptionSt ate&) const;
205 PassRefPtr<ImageData> getImageData(float sx, float sy, float sw, float sh, E xceptionState&) const; 193 PassRefPtr<ImageData> getImageData(float sx, float sy, float sw, float sh, E xceptionState&) const;
206 void putImageData(ImageData*, float dx, float dy, ExceptionState&); 194 void putImageData(ImageData*, float dx, float dy, ExceptionState&);
207 void putImageData(ImageData*, float dx, float dy, float dirtyX, float dirtyY , float dirtyWidth, float dirtyHeight, ExceptionState&); 195 void putImageData(ImageData*, float dx, float dy, float dirtyX, float dirtyY , float dirtyWidth, float dirtyHeight, ExceptionState&);
208 196
209 // Slated for deprecation: 197 // Slated for deprecation:
210 void webkitPutImageDataHD(ImageData* image, float dx, float dy, ExceptionSta te& e) { putImageData(image, dx, dy, e); } 198 void webkitPutImageDataHD(ImageData* image, float dx, float dy, ExceptionSta te& e) { putImageData(image, dx, dy, e); }
211 void webkitPutImageDataHD(ImageData* image, float dx, float dy, float dirtyX , float dirtyY, float dirtyWidth, float dirtyHeight, ExceptionState& e) { putIma geData(image, dx, dy, dirtyX, dirtyY, dirtyWidth, dirtyHeight, e); } 199 void webkitPutImageDataHD(ImageData* image, float dx, float dy, float dirtyX , float dirtyY, float dirtyWidth, float dirtyHeight, ExceptionState& e) { putIma geData(image, dx, dy, dirtyX, dirtyY, dirtyWidth, dirtyHeight, e); }
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 CanvasRenderingContext2D(HTMLCanvasElement*, const Canvas2DContextAttributes * attrs, bool usesCSSCompatibilityParseMode); 273 CanvasRenderingContext2D(HTMLCanvasElement*, const Canvas2DContextAttributes * attrs, bool usesCSSCompatibilityParseMode);
286 274
287 State& modifiableState() { ASSERT(!state().m_unrealizedSaveCount); return m_ stateStack.last(); } 275 State& modifiableState() { ASSERT(!state().m_unrealizedSaveCount); return m_ stateStack.last(); }
288 const State& state() const { return m_stateStack.last(); } 276 const State& state() const { return m_stateStack.last(); }
289 277
290 void applyLineDash() const; 278 void applyLineDash() const;
291 void setShadow(const FloatSize& offset, float blur, RGBA32 color); 279 void setShadow(const FloatSize& offset, float blur, RGBA32 color);
292 void applyShadow(); 280 void applyShadow();
293 bool shouldDrawShadows() const; 281 bool shouldDrawShadows() const;
294 282
295 void drawImageInternal(Image*, const FloatRect&, const FloatRect&, const Com positeOperator&, const blink::WebBlendMode&);
296 bool computeDirtyRect(const FloatRect& localBounds, FloatRect*); 283 bool computeDirtyRect(const FloatRect& localBounds, FloatRect*);
297 bool computeDirtyRect(const FloatRect& localBounds, const FloatRect& transfo rmedClipBounds, FloatRect*); 284 bool computeDirtyRect(const FloatRect& localBounds, const FloatRect& transfo rmedClipBounds, FloatRect*);
298 void didDraw(const FloatRect&); 285 void didDraw(const FloatRect&);
299 286
300 GraphicsContext* drawingContext() const; 287 GraphicsContext* drawingContext() const;
301 288
302 void unwindStateStack(); 289 void unwindStateStack();
303 void realizeSaves(); 290 void realizeSaves();
304 291
305 void applyStrokePattern(); 292 void applyStrokePattern();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 bool m_usesCSSCompatibilityParseMode; 324 bool m_usesCSSCompatibilityParseMode;
338 bool m_hasAlpha; 325 bool m_hasAlpha;
339 MutableStylePropertyMap m_fetchedFonts; 326 MutableStylePropertyMap m_fetchedFonts;
340 }; 327 };
341 328
342 DEFINE_TYPE_CASTS(CanvasRenderingContext2D, CanvasRenderingContext, context, con text->is2d(), context.is2d()); 329 DEFINE_TYPE_CASTS(CanvasRenderingContext2D, CanvasRenderingContext, context, con text->is2d(), context.is2d());
343 330
344 } // namespace WebCore 331 } // namespace WebCore
345 332
346 #endif 333 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698