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

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

Issue 2849643002: Implement ImageData::CropRect() (Closed)
Patch Set: Rebaseline Created 3 years, 6 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "modules/canvas2d/CanvasRenderingContext2D.h" 5 #include "modules/canvas2d/CanvasRenderingContext2D.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include "bindings/core/v8/V8BindingForCore.h" 8 #include "bindings/core/v8/V8BindingForCore.h"
9 #include "bindings/core/v8/V8BindingForTesting.h" 9 #include "bindings/core/v8/V8BindingForTesting.h"
10 #include "core/dom/Document.h" 10 #include "core/dom/Document.h"
(...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 return false; 1233 return false;
1234 } 1234 }
1235 1235
1236 SkColorSpaceXform::ColorFormat dst_color_format = 1236 SkColorSpaceXform::ColorFormat dst_color_format =
1237 SkColorSpaceXform::ColorFormat::kRGBA_8888_ColorFormat; 1237 SkColorSpaceXform::ColorFormat::kRGBA_8888_ColorFormat;
1238 if (dst_pixel_format == kF16CanvasPixelFormat) 1238 if (dst_pixel_format == kF16CanvasPixelFormat)
1239 dst_color_format = SkColorSpaceXform::ColorFormat::kRGBA_F32_ColorFormat; 1239 dst_color_format = SkColorSpaceXform::ColorFormat::kRGBA_F32_ColorFormat;
1240 1240
1241 sk_sp<SkColorSpace> src_sk_color_space = nullptr; 1241 sk_sp<SkColorSpace> src_sk_color_space = nullptr;
1242 if (u8_array) { 1242 if (u8_array) {
1243 src_sk_color_space = ImageData::GetSkColorSpaceForTest( 1243 src_sk_color_space =
1244 src_color_space, kRGBA8CanvasPixelFormat); 1244 CanvasColorParams(src_color_space, kRGBA8CanvasPixelFormat)
1245 .GetSkColorSpaceForSkSurfaces();
1245 } else { 1246 } else {
1246 src_sk_color_space = ImageData::GetSkColorSpaceForTest( 1247 src_sk_color_space =
1247 src_color_space, kF16CanvasPixelFormat); 1248 CanvasColorParams(src_color_space, kF16CanvasPixelFormat)
1249 .GetSkColorSpaceForSkSurfaces();
1248 } 1250 }
1249 1251
1250 sk_sp<SkColorSpace> dst_sk_color_space = 1252 sk_sp<SkColorSpace> dst_sk_color_space =
1251 ImageData::GetSkColorSpaceForTest(dst_color_space, dst_pixel_format); 1253 CanvasColorParams(dst_color_space, dst_pixel_format)
1254 .GetSkColorSpaceForSkSurfaces();
1252 1255
1253 // When the input dataArray is in Uint16, we normally should convert the 1256 // When the input dataArray is in Uint16, we normally should convert the
1254 // values from Little Endian to Big Endian before passing the buffer to 1257 // values from Little Endian to Big Endian before passing the buffer to
1255 // SkColorSpaceXform::apply. However, in this test scenario we are creating 1258 // SkColorSpaceXform::apply. However, in this test scenario we are creating
1256 // the Uin16 dataArray by multiplying a Uint8Clamped array members by 257, 1259 // the Uin16 dataArray by multiplying a Uint8Clamped array members by 257,
1257 // hence the Big Endian and Little Endian representations are the same. 1260 // hence the Big Endian and Little Endian representations are the same.
1258 1261
1259 std::unique_ptr<SkColorSpaceXform> xform = SkColorSpaceXform::New( 1262 std::unique_ptr<SkColorSpaceXform> xform = SkColorSpaceXform::New(
1260 src_sk_color_space.get(), dst_sk_color_space.get()); 1263 src_sk_color_space.get(), dst_sk_color_space.get());
1261 1264
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
1550 1553
1551 // Wake up again, which should request a compositing update synchronously. 1554 // Wake up again, which should request a compositing update synchronously.
1552 GetDocument().GetPage()->SetVisibilityState(kPageVisibilityStateVisible, 1555 GetDocument().GetPage()->SetVisibilityState(kPageVisibilityStateVisible,
1553 false); 1556 false);
1554 EXPECT_EQ(!!CANVAS2D_HIBERNATION_ENABLED, 1557 EXPECT_EQ(!!CANVAS2D_HIBERNATION_ENABLED,
1555 layer->NeedsCompositingInputsUpdate()); 1558 layer->NeedsCompositingInputsUpdate());
1556 RunUntilIdle(); // Clear task queue. 1559 RunUntilIdle(); // Clear task queue.
1557 } 1560 }
1558 1561
1559 } // namespace blink 1562 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698