| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 #include "platform/text/BidiTextRun.h" | 44 #include "platform/text/BidiTextRun.h" |
| 45 #include "platform/text/StringTruncator.h" | 45 #include "platform/text/StringTruncator.h" |
| 46 #include "platform/text/TextRun.h" | 46 #include "platform/text/TextRun.h" |
| 47 #include "platform/transforms/AffineTransform.h" | 47 #include "platform/transforms/AffineTransform.h" |
| 48 #include "platform/weborigin/KURL.h" | 48 #include "platform/weborigin/KURL.h" |
| 49 #include "platform/wtf/PtrUtil.h" | 49 #include "platform/wtf/PtrUtil.h" |
| 50 #include "platform/wtf/RefPtr.h" | 50 #include "platform/wtf/RefPtr.h" |
| 51 #include "platform/wtf/text/WTFString.h" | 51 #include "platform/wtf/text/WTFString.h" |
| 52 #include "skia/ext/image_operations.h" | 52 #include "skia/ext/image_operations.h" |
| 53 #include "third_party/skia/include/core/SkCanvas.h" | 53 #include "third_party/skia/include/core/SkCanvas.h" |
| 54 #include "third_party/skia/include/core/SkColorSpaceXformCanvas.h" |
| 54 #include "third_party/skia/include/core/SkImage.h" | 55 #include "third_party/skia/include/core/SkImage.h" |
| 55 #include "third_party/skia/include/core/SkMatrix.h" | 56 #include "third_party/skia/include/core/SkMatrix.h" |
| 56 #include "third_party/skia/include/core/SkSurface.h" | 57 #include "third_party/skia/include/core/SkSurface.h" |
| 57 | 58 |
| 58 namespace blink { | 59 namespace blink { |
| 59 | 60 |
| 60 namespace { | 61 namespace { |
| 61 | 62 |
| 62 const float kDragLabelBorderX = 4; | 63 const float kDragLabelBorderX = 4; |
| 63 // Keep border_y in synch with DragController::LinkDragBorderInset. | 64 // Keep border_y in synch with DragController::LinkDragBorderInset. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 107 |
| 107 SkPaint paint; | 108 SkPaint paint; |
| 108 DCHECK_GE(opacity, 0); | 109 DCHECK_GE(opacity, 0); |
| 109 DCHECK_LE(opacity, 1); | 110 DCHECK_LE(opacity, 1); |
| 110 paint.setAlpha(opacity * 255); | 111 paint.setAlpha(opacity * 255); |
| 111 paint.setFilterQuality(interpolation_quality == kInterpolationNone | 112 paint.setFilterQuality(interpolation_quality == kInterpolationNone |
| 112 ? kNone_SkFilterQuality | 113 ? kNone_SkFilterQuality |
| 113 : kHigh_SkFilterQuality); | 114 : kHigh_SkFilterQuality); |
| 114 | 115 |
| 115 SkCanvas* canvas = surface->getCanvas(); | 116 SkCanvas* canvas = surface->getCanvas(); |
| 117 std::unique_ptr<SkCanvas> color_transform_canvas; |
| 118 if (RuntimeEnabledFeatures::colorCorrectRenderingEnabled()) { |
| 119 color_transform_canvas = |
| 120 SkCreateColorSpaceXformCanvas(canvas, SkColorSpace::MakeSRGB()); |
| 121 canvas = color_transform_canvas.get(); |
| 122 } |
| 116 canvas->concat(AffineTransformToSkMatrix(transform)); | 123 canvas->concat(AffineTransformToSkMatrix(transform)); |
| 117 canvas->drawImage(image.sk_image(), 0, 0, &paint); | 124 canvas->drawImage(image.sk_image(), 0, 0, &paint); |
| 118 | 125 |
| 119 return PaintImage(image.stable_id(), surface->makeImageSnapshot(), | 126 return PaintImage(image.stable_id(), surface->makeImageSnapshot(), |
| 120 image.animation_type(), image.completion_state()); | 127 image.animation_type(), image.completion_state()); |
| 121 } | 128 } |
| 122 | 129 |
| 123 FloatSize DragImage::ClampedImageScale(const IntSize& image_size, | 130 FloatSize DragImage::ClampedImageScale(const IntSize& image_size, |
| 124 const IntSize& size, | 131 const IntSize& size, |
| 125 const IntSize& max_size) { | 132 const IntSize& max_size) { |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 interpolation_quality_ == kInterpolationNone | 329 interpolation_quality_ == kInterpolationNone |
| 323 ? skia::ImageOperations::RESIZE_BOX | 330 ? skia::ImageOperations::RESIZE_BOX |
| 324 : skia::ImageOperations::RESIZE_LANCZOS3; | 331 : skia::ImageOperations::RESIZE_LANCZOS3; |
| 325 int image_width = scale_x * bitmap_.width(); | 332 int image_width = scale_x * bitmap_.width(); |
| 326 int image_height = scale_y * bitmap_.height(); | 333 int image_height = scale_y * bitmap_.height(); |
| 327 bitmap_ = skia::ImageOperations::Resize(bitmap_, resize_method, image_width, | 334 bitmap_ = skia::ImageOperations::Resize(bitmap_, resize_method, image_width, |
| 328 image_height); | 335 image_height); |
| 329 } | 336 } |
| 330 | 337 |
| 331 } // namespace blink | 338 } // namespace blink |
| OLD | NEW |