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

Side by Side Diff: Source/platform/graphics/ImageBufferSurface.cpp

Issue 1334703002: NOT FOR LANDING Pass URL to Image::draw (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « Source/platform/graphics/Image.cpp ('k') | Source/platform/graphics/ImageLayerChromiumTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013, Google Inc. All rights reserved. 2 * Copyright (c) 2013, Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 17 matching lines...) Expand all
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 32
33 #include "platform/graphics/ImageBufferSurface.h" 33 #include "platform/graphics/ImageBufferSurface.h"
34 34
35 #include "platform/graphics/GraphicsContext.h" 35 #include "platform/graphics/GraphicsContext.h"
36 #include "platform/graphics/ImageBuffer.h" 36 #include "platform/graphics/ImageBuffer.h"
37 #include "platform/graphics/StaticBitmapImage.h" 37 #include "platform/graphics/StaticBitmapImage.h"
38 #include "platform/weborigin/KURL.h"
38 #include "third_party/skia/include/core/SkCanvas.h" 39 #include "third_party/skia/include/core/SkCanvas.h"
39 #include "third_party/skia/include/core/SkDevice.h" 40 #include "third_party/skia/include/core/SkDevice.h"
40 #include "third_party/skia/include/core/SkImage.h" 41 #include "third_party/skia/include/core/SkImage.h"
41 #include "third_party/skia/include/core/SkPicture.h" 42 #include "third_party/skia/include/core/SkPicture.h"
42 43
43 namespace blink { 44 namespace blink {
44 45
45 ImageBufferSurface::ImageBufferSurface(const IntSize& size, OpacityMode opacityM ode) 46 ImageBufferSurface::ImageBufferSurface(const IntSize& size, OpacityMode opacityM ode)
46 : m_opacityMode(opacityMode) 47 : m_opacityMode(opacityMode)
47 , m_size(size) 48 , m_size(size)
(...skipping 23 matching lines...) Expand all
71 } 72 }
72 } 73 }
73 74
74 void ImageBufferSurface::draw(GraphicsContext* context, const FloatRect& destRec t, const FloatRect& srcRect, SkXfermode::Mode op) 75 void ImageBufferSurface::draw(GraphicsContext* context, const FloatRect& destRec t, const FloatRect& srcRect, SkXfermode::Mode op)
75 { 76 {
76 RefPtr<SkImage> snapshot = newImageSnapshot(); 77 RefPtr<SkImage> snapshot = newImageSnapshot();
77 if (!snapshot) 78 if (!snapshot)
78 return; 79 return;
79 80
80 RefPtr<Image> image = StaticBitmapImage::create(snapshot.release()); 81 RefPtr<Image> image = StaticBitmapImage::create(snapshot.release());
81 context->drawImage(image.get(), destRect, srcRect, op); 82 context->drawImage(image.get(), destRect, srcRect, KURL(), op); // TODO(davv e): empty url
82 } 83 }
83 84
84 const SkBitmap& ImageBufferSurface::deprecatedBitmapForOverwrite() 85 const SkBitmap& ImageBufferSurface::deprecatedBitmapForOverwrite()
85 { 86 {
86 ASSERT_NOT_REACHED(); // should only be called on non-accelerated surface ty pes, which have overrides 87 ASSERT_NOT_REACHED(); // should only be called on non-accelerated surface ty pes, which have overrides
87 return canvas()->getDevice()->accessBitmap(false); // Because we have to ret urn something for the code to compile, and it can't be a local (by address). 88 return canvas()->getDevice()->accessBitmap(false); // Because we have to ret urn something for the code to compile, and it can't be a local (by address).
88 } 89 }
89 90
90 91
91 void ImageBufferSurface::flush() 92 void ImageBufferSurface::flush()
92 { 93 {
93 canvas()->flush(); 94 canvas()->flush();
94 } 95 }
95 96
96 bool ImageBufferSurface::writePixels(const SkImageInfo& origInfo, const void* pi xels, size_t rowBytes, int x, int y) 97 bool ImageBufferSurface::writePixels(const SkImageInfo& origInfo, const void* pi xels, size_t rowBytes, int x, int y)
97 { 98 {
98 return canvas()->writePixels(origInfo, pixels, rowBytes, x, y); 99 return canvas()->writePixels(origInfo, pixels, rowBytes, x, y);
99 } 100 }
100 101
101 } // namespace blink 102 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/graphics/Image.cpp ('k') | Source/platform/graphics/ImageLayerChromiumTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698