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

Side by Side Diff: third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp

Issue 1694263003: Add Image::updateConcreteSize() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@refactor-size-calculation-in
Patch Set: Pull test for now, needs changes in upcoming CL to pass. Address nits. Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies)
4 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 4 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> 6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org>
7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
8 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved. 8 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved.
9 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 9 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
10 * 10 *
(...skipping 1249 matching lines...) Expand 10 before | Expand all | Expand 10 after
1260 return value.getAsHTMLCanvasElement().get(); 1260 return value.getAsHTMLCanvasElement().get();
1261 if (value.isImageBitmap()) 1261 if (value.isImageBitmap())
1262 return value.getAsImageBitmap().get(); 1262 return value.getAsImageBitmap().get();
1263 ASSERT_NOT_REACHED(); 1263 ASSERT_NOT_REACHED();
1264 return nullptr; 1264 return nullptr;
1265 } 1265 }
1266 1266
1267 void CanvasRenderingContext2D::drawImage(const CanvasImageSourceUnion& imageSour ce, double x, double y, ExceptionState& exceptionState) 1267 void CanvasRenderingContext2D::drawImage(const CanvasImageSourceUnion& imageSour ce, double x, double y, ExceptionState& exceptionState)
1268 { 1268 {
1269 CanvasImageSource* imageSourceInternal = toImageSourceInternal(imageSource); 1269 CanvasImageSource* imageSourceInternal = toImageSourceInternal(imageSource);
1270 imageSourceInternal->updateConcreteObjectSize(FloatSize(canvas()->width(), c anvas()->height()));
Justin Novosad 2016/02/23 15:53:04 I did some spec analysis on this. The spec for dra
davve 2016/02/23 18:40:31 The contain constraint is actually not added yet,
1270 FloatSize sourceRectSize = imageSourceInternal->elementSize(); 1271 FloatSize sourceRectSize = imageSourceInternal->elementSize();
1271 FloatSize destRectSize = imageSourceInternal->defaultDestinationSize(); 1272 FloatSize destRectSize = imageSourceInternal->defaultDestinationSize();
1272 drawImage(imageSourceInternal, 0, 0, sourceRectSize.width(), sourceRectSize. height(), x, y, destRectSize.width(), destRectSize.height(), exceptionState); 1273 drawImage(imageSourceInternal, 0, 0, sourceRectSize.width(), sourceRectSize. height(), x, y, destRectSize.width(), destRectSize.height(), exceptionState);
1273 } 1274 }
1274 1275
1275 void CanvasRenderingContext2D::drawImage(const CanvasImageSourceUnion& imageSour ce, 1276 void CanvasRenderingContext2D::drawImage(const CanvasImageSourceUnion& imageSour ce,
1276 double x, double y, double width, double height, ExceptionState& exceptionSt ate) 1277 double x, double y, double width, double height, ExceptionState& exceptionSt ate)
1277 { 1278 {
1278 CanvasImageSource* imageSourceInternal = toImageSourceInternal(imageSource); 1279 CanvasImageSource* imageSourceInternal = toImageSourceInternal(imageSource);
1280 imageSourceInternal->updateConcreteObjectSize(FloatSize(canvas()->width(), c anvas()->height()));
Justin Novosad 2016/02/23 15:53:04 In this case, the change also seem to comply with
davve 2016/02/23 18:40:31 As I said above, this patch is mostly plumbing and
1279 FloatSize sourceRectSize = imageSourceInternal->elementSize(); 1281 FloatSize sourceRectSize = imageSourceInternal->elementSize();
1280 drawImage(imageSourceInternal, 0, 0, sourceRectSize.width(), sourceRectSize. height(), x, y, width, height, exceptionState); 1282 drawImage(imageSourceInternal, 0, 0, sourceRectSize.width(), sourceRectSize. height(), x, y, width, height, exceptionState);
1281 } 1283 }
1282 1284
1283 void CanvasRenderingContext2D::drawImage(const CanvasImageSourceUnion& imageSour ce, 1285 void CanvasRenderingContext2D::drawImage(const CanvasImageSourceUnion& imageSour ce,
1284 double sx, double sy, double sw, double sh, 1286 double sx, double sy, double sw, double sh,
1285 double dx, double dy, double dw, double dh, ExceptionState& exceptionState) 1287 double dx, double dy, double dw, double dh, ExceptionState& exceptionState)
1286 { 1288 {
1287 CanvasImageSource* imageSourceInternal = toImageSourceInternal(imageSource); 1289 CanvasImageSource* imageSourceInternal = toImageSourceInternal(imageSource);
Justin Novosad 2016/02/23 15:53:04 Here, we still have a problem. Even though the sou
davve 2016/02/23 18:40:31 Yes, I haven't gotten to this branch yet since it
1288 drawImage(imageSourceInternal, sx, sy, sw, sh, dx, dy, dw, dh, exceptionStat e); 1290 drawImage(imageSourceInternal, sx, sy, sw, sh, dx, dy, dw, dh, exceptionStat e);
1289 } 1291 }
1290 1292
1291 bool CanvasRenderingContext2D::shouldDrawImageAntialiased(const FloatRect& destR ect) const 1293 bool CanvasRenderingContext2D::shouldDrawImageAntialiased(const FloatRect& destR ect) const
1292 { 1294 {
1293 if (!shouldAntialias()) 1295 if (!shouldAntialias())
1294 return false; 1296 return false;
1295 SkCanvas* c = drawingCanvas(); 1297 SkCanvas* c = drawingCanvas();
1296 ASSERT(c); 1298 ASSERT(c);
1297 1299
(...skipping 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after
2368 if (imageType == CanvasRenderingContext2DState::NonOpaqueImage) 2370 if (imageType == CanvasRenderingContext2DState::NonOpaqueImage)
2369 return; 2371 return;
2370 if (alpha < 0xFF) 2372 if (alpha < 0xFF)
2371 return; 2373 return;
2372 } 2374 }
2373 2375
2374 canvas()->buffer()->willOverwriteCanvas(); 2376 canvas()->buffer()->willOverwriteCanvas();
2375 } 2377 }
2376 2378
2377 } // namespace blink 2379 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698