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

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: response to comments 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 void setShadow(float width, float height, float blur); 167 void setShadow(float width, float height, float blur);
167 void setShadow(float width, float height, float blur, const String& color); 168 void setShadow(float width, float height, float blur, const String& color);
168 void setShadow(float width, float height, float blur, float grayLevel); 169 void setShadow(float width, float height, float blur, float grayLevel);
169 void setShadow(float width, float height, float blur, const String& color, f loat alpha); 170 void setShadow(float width, float height, float blur, const String& color, f loat alpha);
170 void setShadow(float width, float height, float blur, float grayLevel, float alpha); 171 void setShadow(float width, float height, float blur, float grayLevel, float alpha);
171 void setShadow(float width, float height, float blur, float r, float g, floa t b, float a); 172 void setShadow(float width, float height, float blur, float r, float g, floa t b, float a);
172 void setShadow(float width, float height, float blur, float c, float m, floa t y, float k, float a); 173 void setShadow(float width, float height, float blur, float c, float m, floa t y, float k, float a);
173 174
174 void clearShadow(); 175 void clearShadow();
175 176
176 void drawImage(ImageBitmap*, float x, float y, ExceptionState&); 177 void drawImage(CanvasImageSource*, float x, float y, ExceptionState&);
177 void drawImage(ImageBitmap*, float x, float y, float width, float height, Ex ceptionState&); 178 void drawImage(CanvasImageSource*, float x, float y, float width, float heig ht, ExceptionState&);
178 void drawImage(ImageBitmap*, float sx, float sy, float sw, float sh, float d x, float dy, float dw, float dh, ExceptionState&); 179 void drawImage(CanvasImageSource*, float sx, float sy, float sw, float sh, f loat dx, float dy, float dw, float dh, ExceptionState&);
179 void drawImage(HTMLImageElement*, float x, float y, ExceptionState&); 180 void drawImage(CanvasImageSource*, const FloatRect& srcRect, const FloatRect & dstRect, ExceptionState&);
180 void drawImage(HTMLImageElement*, float x, float y, float width, float heigh t, ExceptionState&);
181 void drawImage(HTMLImageElement*, float sx, float sy, float sw, float sh, fl oat dx, float dy, float dw, float dh, ExceptionState&);
182 void drawImage(HTMLImageElement*, const FloatRect& srcRect, const FloatRect& dstRect, ExceptionState&);
183 void drawImage(HTMLImageElement*, const FloatRect& srcRect, const FloatRect& dstRect, const CompositeOperator&, const blink::WebBlendMode&, ExceptionState&) ;
184 void drawImage(HTMLCanvasElement*, float x, float y, ExceptionState&);
185 void drawImage(HTMLCanvasElement*, float x, float y, float width, float heig ht, ExceptionState&);
186 void drawImage(HTMLCanvasElement*, float sx, float sy, float sw, float sh, f loat dx, float dy, float dw, float dh, ExceptionState&);
187 void drawImage(HTMLCanvasElement*, const FloatRect& srcRect, const FloatRect & dstRect, ExceptionState&);
188 void drawImage(HTMLVideoElement*, float x, float y, ExceptionState&);
189 void drawImage(HTMLVideoElement*, float x, float y, float width, float heigh t, ExceptionState&);
190 void drawImage(HTMLVideoElement*, float sx, float sy, float sw, float sh, fl oat dx, float dy, float dw, float dh, ExceptionState&);
191 void drawImage(HTMLVideoElement*, const FloatRect& srcRect, const FloatRect& dstRect, ExceptionState&);
192 181
193 void drawImageFromRect(HTMLImageElement*, float sx = 0, float sy = 0, float sw = 0, float sh = 0, 182 void drawImageFromRect(HTMLImageElement*, float sx = 0, float sy = 0, float sw = 0, float sh = 0,
194 float dx = 0, float dy = 0, float dw = 0, float dh = 0, const String& compositeOperation = emptyString()); 183 float dx = 0, float dy = 0, float dw = 0, float dh = 0, const String& compositeOperation = emptyString());
195 184
196 void setAlpha(float); 185 void setAlpha(float);
197 186
198 void setCompositeOperation(const String&); 187 void setCompositeOperation(const String&);
199 188
200 PassRefPtr<CanvasGradient> createLinearGradient(float x0, float y0, float x1 , float y1, ExceptionState&); 189 PassRefPtr<CanvasGradient> createLinearGradient(float x0, float y0, float x1 , float y1, ExceptionState&);
201 PassRefPtr<CanvasGradient> createRadialGradient(float x0, float y0, float r0 , float x1, float y1, float r1, ExceptionState&); 190 PassRefPtr<CanvasGradient> createRadialGradient(float x0, float y0, float r0 , float x1, float y1, float r1, ExceptionState&);
202 PassRefPtr<CanvasPattern> createPattern(HTMLImageElement*, const String& rep etitionType, ExceptionState&); 191 PassRefPtr<CanvasPattern> createPattern(CanvasImageSource*, const String& re petitionType, ExceptionState&);
203 PassRefPtr<CanvasPattern> createPattern(HTMLCanvasElement*, const String& re petitionType, ExceptionState&);
204 192
205 PassRefPtr<ImageData> createImageData(PassRefPtr<ImageData>, ExceptionState& ) const; 193 PassRefPtr<ImageData> createImageData(PassRefPtr<ImageData>, ExceptionState& ) const;
206 PassRefPtr<ImageData> createImageData(float width, float height, ExceptionSt ate&) const; 194 PassRefPtr<ImageData> createImageData(float width, float height, ExceptionSt ate&) const;
207 PassRefPtr<ImageData> getImageData(float sx, float sy, float sw, float sh, E xceptionState&) const; 195 PassRefPtr<ImageData> getImageData(float sx, float sy, float sw, float sh, E xceptionState&) const;
208 void putImageData(ImageData*, float dx, float dy, ExceptionState&); 196 void putImageData(ImageData*, float dx, float dy, ExceptionState&);
209 void putImageData(ImageData*, float dx, float dy, float dirtyX, float dirtyY , float dirtyWidth, float dirtyHeight, ExceptionState&); 197 void putImageData(ImageData*, float dx, float dy, float dirtyX, float dirtyY , float dirtyWidth, float dirtyHeight, ExceptionState&);
210 198
211 // Slated for deprecation: 199 // Slated for deprecation:
212 void webkitPutImageDataHD(ImageData* image, float dx, float dy, ExceptionSta te& e) { putImageData(image, dx, dy, e); } 200 void webkitPutImageDataHD(ImageData* image, float dx, float dy, ExceptionSta te& e) { putImageData(image, dx, dy, e); }
213 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); } 201 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
287 CanvasRenderingContext2D(HTMLCanvasElement*, const Canvas2DContextAttributes * attrs, bool usesCSSCompatibilityParseMode); 275 CanvasRenderingContext2D(HTMLCanvasElement*, const Canvas2DContextAttributes * attrs, bool usesCSSCompatibilityParseMode);
288 276
289 State& modifiableState() { ASSERT(!state().m_unrealizedSaveCount); return m_ stateStack.last(); } 277 State& modifiableState() { ASSERT(!state().m_unrealizedSaveCount); return m_ stateStack.last(); }
290 const State& state() const { return m_stateStack.last(); } 278 const State& state() const { return m_stateStack.last(); }
291 279
292 void applyLineDash() const; 280 void applyLineDash() const;
293 void setShadow(const FloatSize& offset, float blur, RGBA32 color); 281 void setShadow(const FloatSize& offset, float blur, RGBA32 color);
294 void applyShadow(); 282 void applyShadow();
295 bool shouldDrawShadows() const; 283 bool shouldDrawShadows() const;
296 284
297 void drawImageInternal(Image*, const FloatRect&, const FloatRect&, const Com positeOperator&, const blink::WebBlendMode&);
298 bool computeDirtyRect(const FloatRect& localBounds, FloatRect*); 285 bool computeDirtyRect(const FloatRect& localBounds, FloatRect*);
299 bool computeDirtyRect(const FloatRect& localBounds, const FloatRect& transfo rmedClipBounds, FloatRect*); 286 bool computeDirtyRect(const FloatRect& localBounds, const FloatRect& transfo rmedClipBounds, FloatRect*);
300 void didDraw(const FloatRect&); 287 void didDraw(const FloatRect&);
301 288
302 GraphicsContext* drawingContext() const; 289 GraphicsContext* drawingContext() const;
303 290
304 void unwindStateStack(); 291 void unwindStateStack();
305 void realizeSaves(); 292 void realizeSaves();
306 293
307 void applyStrokePattern(); 294 void applyStrokePattern();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 bool m_usesCSSCompatibilityParseMode; 326 bool m_usesCSSCompatibilityParseMode;
340 bool m_hasAlpha; 327 bool m_hasAlpha;
341 MutableStylePropertyMap m_fetchedFonts; 328 MutableStylePropertyMap m_fetchedFonts;
342 }; 329 };
343 330
344 DEFINE_TYPE_CASTS(CanvasRenderingContext2D, CanvasRenderingContext, context, con text->is2d(), context.is2d()); 331 DEFINE_TYPE_CASTS(CanvasRenderingContext2D, CanvasRenderingContext, context, con text->is2d(), context.is2d());
345 332
346 } // namespace WebCore 333 } // namespace WebCore
347 334
348 #endif 335 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698