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

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

Issue 1195513002: Use SkImage snapshots for ImageBufferSurface texture access (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: review comments Created 5 years, 6 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 | Annotate | Revision Log
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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 willAccessPixels(); 75 willAccessPixels();
76 return canvas()->getDevice()->accessBitmap(false); 76 return canvas()->getDevice()->accessBitmap(false);
77 } 77 }
78 78
79 const SkBitmap& ImageBufferSurface::cachedBitmap() const 79 const SkBitmap& ImageBufferSurface::cachedBitmap() const
80 { 80 {
81 DEFINE_STATIC_LOCAL(SkBitmap, nullBitmap, ()); 81 DEFINE_STATIC_LOCAL(SkBitmap, nullBitmap, ());
82 return nullBitmap; 82 return nullBitmap;
83 } 83 }
84 84
85 PassRefPtr<SkImage> ImageBufferSurface::newImageSnapshot() const
86 {
87 return nullptr;
88 }
89
90 void ImageBufferSurface::draw(GraphicsContext* context, const FloatRect& destRec t, const FloatRect& srcRect, SkXfermode::Mode op) 85 void ImageBufferSurface::draw(GraphicsContext* context, const FloatRect& destRec t, const FloatRect& srcRect, SkXfermode::Mode op)
91 { 86 {
92 SkBitmap bmp = bitmap(); 87 SkBitmap bmp = bitmap();
93 // For ImageBufferSurface that enables cachedBitmap, Use the cached bitmap f or CPU side usage 88 // For ImageBufferSurface that enables cachedBitmap, Use the cached bitmap f or CPU side usage
94 // if it is available, otherwise generate and use it. 89 // if it is available, otherwise generate and use it.
95 if (isAccelerated() && cachedBitmapEnabled() && isValid()) { 90 if (isAccelerated() && cachedBitmapEnabled() && isValid()) {
96 updateCachedBitmapIfNeeded(); 91 updateCachedBitmapIfNeeded();
97 bmp = cachedBitmap(); 92 bmp = cachedBitmap();
98 } 93 }
99 94
100 RefPtr<Image> image = BitmapImage::create(bmp); 95 RefPtr<Image> image = BitmapImage::create(bmp);
101 96
102 context->drawImage(image.get(), destRect, srcRect, op, DoNotRespectImageOrie ntation); 97 context->drawImage(image.get(), destRect, srcRect, op, DoNotRespectImageOrie ntation);
103 } 98 }
104 99
105 } // namespace blink 100 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698