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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp

Issue 2640983002: Rename paint data structures (Closed)
Patch Set: Re-add ios changes Created 3 years, 10 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 "platform/graphics/StaticBitmapImage.h" 5 #include "platform/graphics/StaticBitmapImage.h"
6 6
7 #include "platform/graphics/AcceleratedStaticBitmapImage.h" 7 #include "platform/graphics/AcceleratedStaticBitmapImage.h"
8 #include "platform/graphics/GraphicsContext.h" 8 #include "platform/graphics/GraphicsContext.h"
9 #include "platform/graphics/ImageObserver.h" 9 #include "platform/graphics/ImageObserver.h"
10 #include "platform/graphics/UnacceleratedStaticBitmapImage.h" 10 #include "platform/graphics/UnacceleratedStaticBitmapImage.h"
11 #include "third_party/skia/include/core/SkCanvas.h" 11 #include "third_party/skia/include/core/SkCanvas.h"
12 #include "third_party/skia/include/core/SkImage.h" 12 #include "third_party/skia/include/core/SkImage.h"
13 #include "third_party/skia/include/core/SkPaint.h" 13 #include "third_party/skia/include/core/SkPaint.h"
14 14
15 namespace blink { 15 namespace blink {
16 16
17 PassRefPtr<StaticBitmapImage> StaticBitmapImage::create(sk_sp<SkImage> image) { 17 PassRefPtr<StaticBitmapImage> StaticBitmapImage::create(sk_sp<SkImage> image) {
18 if (!image) 18 if (!image)
19 return nullptr; 19 return nullptr;
20 if (image->isTextureBacked()) 20 if (image->isTextureBacked())
21 return AcceleratedStaticBitmapImage::createFromSharedContextImage( 21 return AcceleratedStaticBitmapImage::createFromSharedContextImage(
22 std::move(image)); 22 std::move(image));
23 return UnacceleratedStaticBitmapImage::create(std::move(image)); 23 return UnacceleratedStaticBitmapImage::create(std::move(image));
24 } 24 }
25 25
26 void StaticBitmapImage::drawHelper(SkCanvas* canvas, 26 void StaticBitmapImage::drawHelper(PaintCanvas* canvas,
27 const SkPaint& paint, 27 const PaintFlags& paint,
28 const FloatRect& dstRect, 28 const FloatRect& dstRect,
29 const FloatRect& srcRect, 29 const FloatRect& srcRect,
30 ImageClampingMode clampMode, 30 ImageClampingMode clampMode,
31 sk_sp<SkImage> image) { 31 sk_sp<SkImage> image) {
32 FloatRect adjustedSrcRect = srcRect; 32 FloatRect adjustedSrcRect = srcRect;
33 adjustedSrcRect.intersect(SkRect::Make(image->bounds())); 33 adjustedSrcRect.intersect(SkRect::Make(image->bounds()));
34 34
35 if (dstRect.isEmpty() || adjustedSrcRect.isEmpty()) 35 if (dstRect.isEmpty() || adjustedSrcRect.isEmpty())
36 return; // Nothing to draw. 36 return; // Nothing to draw.
37 37
38 canvas->drawImageRect(image.get(), adjustedSrcRect, dstRect, &paint, 38 canvas->drawImageRect(image.get(), adjustedSrcRect, dstRect, &paint,
39 WebCoreClampingModeToSkiaRectConstraint(clampMode)); 39 WebCoreClampingModeToSkiaRectConstraint(clampMode));
40 } 40 }
41 41
42 } // namespace blink 42 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698