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

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

Issue 201513003: Implement InterpolationMedium to filter animated images (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: only ode change Created 6 years, 9 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
« no previous file with comments | « Source/platform/graphics/ImageBuffer.h ('k') | Source/platform/graphics/skia/NativeImageSkia.h » ('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) 2008, Google Inc. All rights reserved. 2 * Copyright (c) 2008, Google Inc. All rights reserved.
3 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 3 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are 7 * modification, are permitted provided that the following conditions are
8 * met: 8 * met:
9 * 9 *
10 * * Redistributions of source code must retain the above copyright 10 * * Redistributions of source code must retain the above copyright
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 return false; 177 return false;
178 blink::WebGraphicsContext3D* context3D = provider->context3d(); 178 blink::WebGraphicsContext3D* context3D = provider->context3d();
179 Platform3DObject tex = m_surface->getBackingTexture(); 179 Platform3DObject tex = m_surface->getBackingTexture();
180 if (!context3D || !tex) 180 if (!context3D || !tex)
181 return false; 181 return false;
182 m_surface->invalidateCachedBitmap(); 182 m_surface->invalidateCachedBitmap();
183 return drawingBuffer->copyToPlatformTexture(context3D, tex, GL_RGBA, 183 return drawingBuffer->copyToPlatformTexture(context3D, tex, GL_RGBA,
184 GL_UNSIGNED_BYTE, 0, true, false); 184 GL_UNSIGNED_BYTE, 0, true, false);
185 } 185 }
186 186
187 void ImageBuffer::draw(GraphicsContext* context, const FloatRect& destRect, cons t FloatRect& srcRect, 187 void ImageBuffer::draw(GraphicsContext* context, const FloatRect& destRect, cons t FloatRect& srcRect, CompositeOperator op, blink::WebBlendMode blendMode)
188 CompositeOperator op, blink::WebBlendMode blendMode, bool useLowQualityScale )
189 { 188 {
190 if (!isValid()) 189 if (!isValid())
191 return; 190 return;
192 191
193 SkBitmap bitmap = m_surface->bitmap(); 192 SkBitmap bitmap = m_surface->bitmap();
194 // For ImageBufferSurface that enables cachedBitmap, Use the cached Bitmap f or CPU side usage 193 // For ImageBufferSurface that enables cachedBitmap, Use the cached Bitmap f or CPU side usage
195 // if it is available, otherwise generate and use it. 194 // if it is available, otherwise generate and use it.
196 if (!context->isAccelerated() && m_surface->isAccelerated() && m_surface->ca chedBitmapEnabled() && m_surface->isValid()) { 195 if (!context->isAccelerated() && m_surface->isAccelerated() && m_surface->ca chedBitmapEnabled() && m_surface->isValid()) {
197 m_surface->updateCachedBitmapIfNeeded(); 196 m_surface->updateCachedBitmapIfNeeded();
198 bitmap = m_surface->cachedBitmap(); 197 bitmap = m_surface->cachedBitmap();
199 } 198 }
200 199
201 RefPtr<Image> image = BitmapImage::create(NativeImageSkia::create(drawNeedsC opy(m_context.get(), context) ? deepSkBitmapCopy(bitmap) : bitmap)); 200 RefPtr<Image> image = BitmapImage::create(NativeImageSkia::create(drawNeedsC opy(m_context.get(), context) ? deepSkBitmapCopy(bitmap) : bitmap));
202 201
203 context->drawImage(image.get(), destRect, srcRect, op, blendMode, DoNotRespe ctImageOrientation, useLowQualityScale); 202 context->drawImage(image.get(), destRect, srcRect, op, blendMode, DoNotRespe ctImageOrientation);
204 } 203 }
205 204
206 void ImageBuffer::flush() 205 void ImageBuffer::flush()
207 { 206 {
208 if (m_surface->canvas()) { 207 if (m_surface->canvas()) {
209 m_surface->canvas()->flush(); 208 m_surface->canvas()->flush();
210 } 209 }
211 } 210 }
212 211
213 void ImageBuffer::drawPattern(GraphicsContext* context, const FloatRect& srcRect , const FloatSize& scale, 212 void ImageBuffer::drawPattern(GraphicsContext* context, const FloatRect& srcRect , const FloatSize& scale,
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 if (!encodeImage(imageData, mimeType, quality, &encodedImage)) 382 if (!encodeImage(imageData, mimeType, quality, &encodedImage))
384 return "data:,"; 383 return "data:,";
385 384
386 Vector<char> base64Data; 385 Vector<char> base64Data;
387 base64Encode(encodedImage, base64Data); 386 base64Encode(encodedImage, base64Data);
388 387
389 return "data:" + mimeType + ";base64," + base64Data; 388 return "data:" + mimeType + ";base64," + base64Data;
390 } 389 }
391 390
392 } // namespace WebCore 391 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/platform/graphics/ImageBuffer.h ('k') | Source/platform/graphics/skia/NativeImageSkia.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698