| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "core/frame/ImageBitmap.h" | 5 #include "core/frame/ImageBitmap.h" |
| 6 | 6 |
| 7 #include "core/html/HTMLCanvasElement.h" | 7 #include "core/html/HTMLCanvasElement.h" |
| 8 #include "core/html/HTMLVideoElement.h" | 8 #include "core/html/HTMLVideoElement.h" |
| 9 #include "core/html/ImageData.h" | 9 #include "core/html/ImageData.h" |
| 10 #include "platform/graphics/skia/SkiaUtils.h" | 10 #include "platform/graphics/skia/SkiaUtils.h" |
| 11 #include "platform/image-decoders/ImageDecoder.h" | 11 #include "platform/image-decoders/ImageDecoder.h" |
| 12 #include "skia/ext/cdl_canvas.h" |
| 13 #include "skia/ext/cdl_paint.h" |
| 12 #include "third_party/skia/include/core/SkCanvas.h" | 14 #include "third_party/skia/include/core/SkCanvas.h" |
| 13 #include "third_party/skia/include/core/SkSurface.h" | 15 #include "third_party/skia/include/core/SkSurface.h" |
| 14 #include "wtf/CheckedNumeric.h" | 16 #include "wtf/CheckedNumeric.h" |
| 15 #include "wtf/PtrUtil.h" | 17 #include "wtf/PtrUtil.h" |
| 16 #include "wtf/RefPtr.h" | 18 #include "wtf/RefPtr.h" |
| 17 #include <memory> | 19 #include <memory> |
| 18 | 20 |
| 19 namespace blink { | 21 namespace blink { |
| 20 | 22 |
| 21 static const char* imageOrientationFlipY = "flipY"; | 23 static const char* imageOrientationFlipY = "flipY"; |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 DoNotInitializeImagePixels); | 435 DoNotInitializeImagePixels); |
| 434 if (!buffer) | 436 if (!buffer) |
| 435 return; | 437 return; |
| 436 | 438 |
| 437 IntPoint dstPoint = | 439 IntPoint dstPoint = |
| 438 IntPoint(-parsedOptions.cropRect.x(), -parsedOptions.cropRect.y()); | 440 IntPoint(-parsedOptions.cropRect.x(), -parsedOptions.cropRect.y()); |
| 439 if (parsedOptions.flipY) { | 441 if (parsedOptions.flipY) { |
| 440 buffer->canvas()->translate(0, buffer->size().height()); | 442 buffer->canvas()->translate(0, buffer->size().height()); |
| 441 buffer->canvas()->scale(1, -1); | 443 buffer->canvas()->scale(1, -1); |
| 442 } | 444 } |
| 443 SkPaint paint; | 445 CdlPaint paint; |
| 444 if (parsedOptions.shouldScaleInput) { | 446 if (parsedOptions.shouldScaleInput) { |
| 445 float scaleRatioX = static_cast<float>(parsedOptions.resizeWidth) / | 447 float scaleRatioX = static_cast<float>(parsedOptions.resizeWidth) / |
| 446 parsedOptions.cropRect.width(); | 448 parsedOptions.cropRect.width(); |
| 447 float scaleRatioY = static_cast<float>(parsedOptions.resizeHeight) / | 449 float scaleRatioY = static_cast<float>(parsedOptions.resizeHeight) / |
| 448 parsedOptions.cropRect.height(); | 450 parsedOptions.cropRect.height(); |
| 449 buffer->canvas()->scale(scaleRatioX, scaleRatioY); | 451 buffer->canvas()->scale(scaleRatioX, scaleRatioY); |
| 450 paint.setFilterQuality(parsedOptions.resizeQuality); | 452 paint.setFilterQuality(parsedOptions.resizeQuality); |
| 451 } | 453 } |
| 452 buffer->canvas()->translate(dstPoint.x(), dstPoint.y()); | 454 buffer->canvas()->translate(dstPoint.x(), dstPoint.y()); |
| 453 video->paintCurrentFrame( | 455 video->paintCurrentFrame( |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 864 void ImageBitmap::adjustDrawRects(FloatRect* srcRect, | 866 void ImageBitmap::adjustDrawRects(FloatRect* srcRect, |
| 865 FloatRect* dstRect) const {} | 867 FloatRect* dstRect) const {} |
| 866 | 868 |
| 867 FloatSize ImageBitmap::elementSize(const FloatSize&) const { | 869 FloatSize ImageBitmap::elementSize(const FloatSize&) const { |
| 868 return FloatSize(width(), height()); | 870 return FloatSize(width(), height()); |
| 869 } | 871 } |
| 870 | 872 |
| 871 DEFINE_TRACE(ImageBitmap) {} | 873 DEFINE_TRACE(ImageBitmap) {} |
| 872 | 874 |
| 873 } // namespace blink | 875 } // namespace blink |
| OLD | NEW |