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

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: applied last corrections 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 29 matching lines...) Expand all
40 #include "platform/graphics/Path.h" 40 #include "platform/graphics/Path.h"
41 #include "platform/transforms/AffineTransform.h" 41 #include "platform/transforms/AffineTransform.h"
42 #include "wtf/HashMap.h" 42 #include "wtf/HashMap.h"
43 #include "wtf/Vector.h" 43 #include "wtf/Vector.h"
44 #include "wtf/text/WTFString.h" 44 #include "wtf/text/WTFString.h"
45 45
46 namespace blink { class WebLayer; } 46 namespace blink { class WebLayer; }
47 47
48 namespace WebCore { 48 namespace WebCore {
49 49
50 class CanvasImageSource;
50 class CanvasGradient; 51 class CanvasGradient;
51 class CanvasPattern; 52 class CanvasPattern;
52 class CanvasStyle; 53 class CanvasStyle;
53 class Path2D; 54 class Path2D;
54 class Element; 55 class Element;
55 class ExceptionState; 56 class ExceptionState;
56 class FloatRect; 57 class FloatRect;
57 class GraphicsContext; 58 class GraphicsContext;
58 class HTMLCanvasElement; 59 class HTMLCanvasElement;
59 class HTMLImageElement; 60 class HTMLImageElement;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 void setShadow(float width, float height, float blur); 171 void setShadow(float width, float height, float blur);
171 void setShadow(float width, float height, float blur, const String& color); 172 void setShadow(float width, float height, float blur, const String& color);
172 void setShadow(float width, float height, float blur, float grayLevel); 173 void setShadow(float width, float height, float blur, float grayLevel);
173 void setShadow(float width, float height, float blur, const String& color, f loat alpha); 174 void setShadow(float width, float height, float blur, const String& color, f loat alpha);
174 void setShadow(float width, float height, float blur, float grayLevel, float alpha); 175 void setShadow(float width, float height, float blur, float grayLevel, float alpha);
175 void setShadow(float width, float height, float blur, float r, float g, floa t b, float a); 176 void setShadow(float width, float height, float blur, float r, float g, floa t b, float a);
176 void setShadow(float width, float height, float blur, float c, float m, floa t y, float k, float a); 177 void setShadow(float width, float height, float blur, float c, float m, floa t y, float k, float a);
177 178
178 void clearShadow(); 179 void clearShadow();
179 180
180 void drawImage(ImageBitmap*, float x, float y, ExceptionState&); 181 void drawImage(CanvasImageSource*, float x, float y, ExceptionState&);
181 void drawImage(ImageBitmap*, float x, float y, float width, float height, Ex ceptionState&); 182 void drawImage(CanvasImageSource*, float x, float y, float width, float heig ht, ExceptionState&);
182 void drawImage(ImageBitmap*, float sx, float sy, float sw, float sh, float d x, float dy, float dw, float dh, ExceptionState&); 183 void drawImage(CanvasImageSource*, float sx, float sy, float sw, float sh, f loat dx, float dy, float dw, float dh, ExceptionState&);
183 void drawImage(HTMLImageElement*, float x, float y, ExceptionState&);
184 void drawImage(HTMLImageElement*, float x, float y, float width, float heigh t, ExceptionState&);
185 void drawImage(HTMLImageElement*, float sx, float sy, float sw, float sh, fl oat dx, float dy, float dw, float dh, ExceptionState&);
186 void drawImage(HTMLImageElement*, const FloatRect& srcRect, const FloatRect& dstRect, ExceptionState&);
187 void drawImage(HTMLImageElement*, const FloatRect& srcRect, const FloatRect& dstRect, const CompositeOperator&, const blink::WebBlendMode&, ExceptionState&) ;
188 void drawImage(HTMLCanvasElement*, float x, float y, ExceptionState&);
189 void drawImage(HTMLCanvasElement*, float x, float y, float width, float heig ht, ExceptionState&);
190 void drawImage(HTMLCanvasElement*, float sx, float sy, float sw, float sh, f loat dx, float dy, float dw, float dh, ExceptionState&);
191 void drawImage(HTMLCanvasElement*, const FloatRect& srcRect, const FloatRect & dstRect, ExceptionState&);
192 void drawImage(HTMLVideoElement*, float x, float y, ExceptionState&);
193 void drawImage(HTMLVideoElement*, float x, float y, float width, float heigh t, ExceptionState&);
194 void drawImage(HTMLVideoElement*, float sx, float sy, float sw, float sh, fl oat dx, float dy, float dw, float dh, ExceptionState&);
195 void drawImage(HTMLVideoElement*, const FloatRect& srcRect, const FloatRect& dstRect, ExceptionState&);
196 184
197 void drawImageFromRect(HTMLImageElement*, float sx = 0, float sy = 0, float sw = 0, float sh = 0, 185 void drawImageFromRect(HTMLImageElement*, float sx = 0, float sy = 0, float sw = 0, float sh = 0,
198 float dx = 0, float dy = 0, float dw = 0, float dh = 0, const String& compositeOperation = emptyString()); 186 float dx = 0, float dy = 0, float dw = 0, float dh = 0, const String& compositeOperation = emptyString());
199 187
200 void setAlpha(float); 188 void setAlpha(float);
201 189
202 void setCompositeOperation(const String&); 190 void setCompositeOperation(const String&);
203 191
204 PassRefPtr<CanvasGradient> createLinearGradient(float x0, float y0, float x1 , float y1, ExceptionState&); 192 PassRefPtr<CanvasGradient> createLinearGradient(float x0, float y0, float x1 , float y1, ExceptionState&);
205 PassRefPtr<CanvasGradient> createRadialGradient(float x0, float y0, float r0 , float x1, float y1, float r1, ExceptionState&); 193 PassRefPtr<CanvasGradient> createRadialGradient(float x0, float y0, float r0 , float x1, float y1, float r1, ExceptionState&);
206 PassRefPtr<CanvasPattern> createPattern(HTMLImageElement*, const String& rep etitionType, ExceptionState&); 194 PassRefPtr<CanvasPattern> createPattern(CanvasImageSource*, const String& re petitionType, ExceptionState&);
207 PassRefPtr<CanvasPattern> createPattern(HTMLCanvasElement*, const String& re petitionType, ExceptionState&);
208 195
209 PassRefPtr<ImageData> createImageData(PassRefPtr<ImageData>, ExceptionState& ) const; 196 PassRefPtr<ImageData> createImageData(PassRefPtr<ImageData>, ExceptionState& ) const;
210 PassRefPtr<ImageData> createImageData(float width, float height, ExceptionSt ate&) const; 197 PassRefPtr<ImageData> createImageData(float width, float height, ExceptionSt ate&) const;
211 PassRefPtr<ImageData> getImageData(float sx, float sy, float sw, float sh, E xceptionState&) const; 198 PassRefPtr<ImageData> getImageData(float sx, float sy, float sw, float sh, E xceptionState&) const;
212 void putImageData(ImageData*, float dx, float dy, ExceptionState&); 199 void putImageData(ImageData*, float dx, float dy, ExceptionState&);
213 void putImageData(ImageData*, float dx, float dy, float dirtyX, float dirtyY , float dirtyWidth, float dirtyHeight, ExceptionState&); 200 void putImageData(ImageData*, float dx, float dy, float dirtyX, float dirtyY , float dirtyWidth, float dirtyHeight, ExceptionState&);
214 201
215 // Slated for deprecation: 202 // Slated for deprecation:
216 void webkitPutImageDataHD(ImageData* image, float dx, float dy, ExceptionSta te& e) { putImageData(image, dx, dy, e); } 203 void webkitPutImageDataHD(ImageData* image, float dx, float dy, ExceptionSta te& e) { putImageData(image, dx, dy, e); }
217 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); } 204 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
291 CanvasRenderingContext2D(HTMLCanvasElement*, const Canvas2DContextAttributes * attrs, bool usesCSSCompatibilityParseMode); 278 CanvasRenderingContext2D(HTMLCanvasElement*, const Canvas2DContextAttributes * attrs, bool usesCSSCompatibilityParseMode);
292 279
293 State& modifiableState() { ASSERT(!state().m_unrealizedSaveCount); return m_ stateStack.last(); } 280 State& modifiableState() { ASSERT(!state().m_unrealizedSaveCount); return m_ stateStack.last(); }
294 const State& state() const { return m_stateStack.last(); } 281 const State& state() const { return m_stateStack.last(); }
295 282
296 void applyLineDash() const; 283 void applyLineDash() const;
297 void setShadow(const FloatSize& offset, float blur, RGBA32 color); 284 void setShadow(const FloatSize& offset, float blur, RGBA32 color);
298 void applyShadow(); 285 void applyShadow();
299 bool shouldDrawShadows() const; 286 bool shouldDrawShadows() const;
300 287
301 void drawImageInternal(Image*, const FloatRect&, const FloatRect&, const Com positeOperator&, const blink::WebBlendMode&);
302 bool computeDirtyRect(const FloatRect& localBounds, FloatRect*); 288 bool computeDirtyRect(const FloatRect& localBounds, FloatRect*);
303 bool computeDirtyRect(const FloatRect& localBounds, const FloatRect& transfo rmedClipBounds, FloatRect*); 289 bool computeDirtyRect(const FloatRect& localBounds, const FloatRect& transfo rmedClipBounds, FloatRect*);
304 void didDraw(const FloatRect&); 290 void didDraw(const FloatRect&);
305 291
306 GraphicsContext* drawingContext() const; 292 GraphicsContext* drawingContext() const;
307 293
308 void unwindStateStack(); 294 void unwindStateStack();
309 void realizeSaves(); 295 void realizeSaves();
310 296
311 void applyStrokePattern(); 297 void applyStrokePattern();
312 void applyFillPattern(); 298 void applyFillPattern();
313 299
300 void drawImageInternal(CanvasImageSource*, float sx, float sy, float sw, flo at sh, float dx, float dy, float dw, float dh, ExceptionState&, CompositeOperato r, blink::WebBlendMode);
301 void drawVideo(HTMLVideoElement*, FloatRect srcRect, FloatRect dstRect);
302
314 void fillInternal(const Path&, const String& windingRuleString); 303 void fillInternal(const Path&, const String& windingRuleString);
315 void strokeInternal(const Path&); 304 void strokeInternal(const Path&);
316 void clipInternal(const Path&, const String& windingRuleString); 305 void clipInternal(const Path&, const String& windingRuleString);
317 306
318 bool isPointInPathInternal(const Path&, const float x, const float y, const String& windingRuleString); 307 bool isPointInPathInternal(const Path&, const float x, const float y, const String& windingRuleString);
319 bool isPointInStrokeInternal(const Path&, const float x, const float y); 308 bool isPointInStrokeInternal(const Path&, const float x, const float y);
320 309
321 void drawTextInternal(const String& text, float x, float y, bool fill, float maxWidth = 0, bool useMaxWidth = false); 310 void drawTextInternal(const String& text, float x, float y, bool fill, float maxWidth = 0, bool useMaxWidth = false);
322 311
323 const Font& accessFont(); 312 const Font& accessFont();
(...skipping 23 matching lines...) Expand all
347 bool m_usesCSSCompatibilityParseMode; 336 bool m_usesCSSCompatibilityParseMode;
348 bool m_hasAlpha; 337 bool m_hasAlpha;
349 MutableStylePropertyMap m_fetchedFonts; 338 MutableStylePropertyMap m_fetchedFonts;
350 }; 339 };
351 340
352 DEFINE_TYPE_CASTS(CanvasRenderingContext2D, CanvasRenderingContext, context, con text->is2d(), context.is2d()); 341 DEFINE_TYPE_CASTS(CanvasRenderingContext2D, CanvasRenderingContext, context, con text->is2d(), context.is2d());
353 342
354 } // namespace WebCore 343 } // namespace WebCore
355 344
356 #endif 345 #endif
OLDNEW
« no previous file with comments | « Source/core/html/canvas/CanvasRenderingContext.cpp ('k') | Source/core/html/canvas/CanvasRenderingContext2D.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698