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

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

Issue 2849643002: Implement ImageData::CropRect() (Closed)
Patch Set: Adding flipping to ImageData::CopyRect() Created 3 years, 7 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 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after
1386 return false; 1386 return false;
1387 } 1387 }
1388 1388
1389 SkColorSpaceXform::ColorFormat dst_color_format = 1389 SkColorSpaceXform::ColorFormat dst_color_format =
1390 SkColorSpaceXform::ColorFormat::kRGBA_8888_ColorFormat; 1390 SkColorSpaceXform::ColorFormat::kRGBA_8888_ColorFormat;
1391 if (dst_pixel_format == kF16CanvasPixelFormat) 1391 if (dst_pixel_format == kF16CanvasPixelFormat)
1392 dst_color_format = SkColorSpaceXform::ColorFormat::kRGBA_F32_ColorFormat; 1392 dst_color_format = SkColorSpaceXform::ColorFormat::kRGBA_F32_ColorFormat;
1393 1393
1394 sk_sp<SkColorSpace> src_sk_color_space = nullptr; 1394 sk_sp<SkColorSpace> src_sk_color_space = nullptr;
1395 if (u8_array) { 1395 if (u8_array) {
1396 src_sk_color_space = ImageData::GetSkColorSpaceForTest( 1396 src_sk_color_space =
1397 src_color_space, kRGBA8CanvasPixelFormat); 1397 CanvasColorParams(src_color_space, kRGBA8CanvasPixelFormat)
1398 .GetSkColorSpaceForSkSurfaces();
1398 } else { 1399 } else {
1399 src_sk_color_space = ImageData::GetSkColorSpaceForTest( 1400 src_sk_color_space =
1400 src_color_space, kF16CanvasPixelFormat); 1401 CanvasColorParams(src_color_space, kF16CanvasPixelFormat)
1402 .GetSkColorSpaceForSkSurfaces();
1401 } 1403 }
1402 1404
1403 sk_sp<SkColorSpace> dst_sk_color_space = 1405 sk_sp<SkColorSpace> dst_sk_color_space =
1404 ImageData::GetSkColorSpaceForTest(dst_color_space, dst_pixel_format); 1406 CanvasColorParams(dst_color_space, dst_pixel_format)
1407 .GetSkColorSpaceForSkSurfaces();
1405 1408
1406 // When the input dataArray is in Uint16, we normally should convert the 1409 // When the input dataArray is in Uint16, we normally should convert the
1407 // values from Little Endian to Big Endian before passing the buffer to 1410 // values from Little Endian to Big Endian before passing the buffer to
1408 // SkColorSpaceXform::apply. However, in this test scenario we are creating 1411 // SkColorSpaceXform::apply. However, in this test scenario we are creating
1409 // the Uin16 dataArray by multiplying a Uint8Clamped array members by 257, 1412 // the Uin16 dataArray by multiplying a Uint8Clamped array members by 257,
1410 // hence the Big Endian and Little Endian representations are the same. 1413 // hence the Big Endian and Little Endian representations are the same.
1411 1414
1412 std::unique_ptr<SkColorSpaceXform> xform = SkColorSpaceXform::New( 1415 std::unique_ptr<SkColorSpaceXform> xform = SkColorSpaceXform::New(
1413 src_sk_color_space.get(), dst_sk_color_space.get()); 1416 src_sk_color_space.get(), dst_sk_color_space.get());
1414 1417
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
1698 1701
1699 // Wake up again, which should request a compositing update synchronously. 1702 // Wake up again, which should request a compositing update synchronously.
1700 GetDocument().GetPage()->SetVisibilityState(kPageVisibilityStateVisible, 1703 GetDocument().GetPage()->SetVisibilityState(kPageVisibilityStateVisible,
1701 false); 1704 false);
1702 EXPECT_EQ(!!CANVAS2D_HIBERNATION_ENABLED, 1705 EXPECT_EQ(!!CANVAS2D_HIBERNATION_ENABLED,
1703 layer->NeedsCompositingInputsUpdate()); 1706 layer->NeedsCompositingInputsUpdate());
1704 RunUntilIdle(); // Clear task queue. 1707 RunUntilIdle(); // Clear task queue.
1705 } 1708 }
1706 1709
1707 } // namespace blink 1710 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698