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

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

Issue 1001703003: Take NativeImageSkia out behind the woodshed. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Make bitmapForCurrentFrame() return SkBitmap by value. Created 5 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
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 25 matching lines...) Expand all
36 #include "GrContext.h" 36 #include "GrContext.h"
37 #include "platform/MIMETypeRegistry.h" 37 #include "platform/MIMETypeRegistry.h"
38 #include "platform/geometry/IntRect.h" 38 #include "platform/geometry/IntRect.h"
39 #include "platform/graphics/BitmapImage.h" 39 #include "platform/graphics/BitmapImage.h"
40 #include "platform/graphics/GraphicsContext.h" 40 #include "platform/graphics/GraphicsContext.h"
41 #include "platform/graphics/GraphicsTypes3D.h" 41 #include "platform/graphics/GraphicsTypes3D.h"
42 #include "platform/graphics/ImageBufferClient.h" 42 #include "platform/graphics/ImageBufferClient.h"
43 #include "platform/graphics/UnacceleratedImageBufferSurface.h" 43 #include "platform/graphics/UnacceleratedImageBufferSurface.h"
44 #include "platform/graphics/gpu/DrawingBuffer.h" 44 #include "platform/graphics/gpu/DrawingBuffer.h"
45 #include "platform/graphics/gpu/Extensions3DUtil.h" 45 #include "platform/graphics/gpu/Extensions3DUtil.h"
46 #include "platform/graphics/skia/NativeImageSkia.h"
47 #include "platform/graphics/skia/SkiaUtils.h" 46 #include "platform/graphics/skia/SkiaUtils.h"
48 #include "platform/image-encoders/skia/JPEGImageEncoder.h" 47 #include "platform/image-encoders/skia/JPEGImageEncoder.h"
49 #include "platform/image-encoders/skia/PNGImageEncoder.h" 48 #include "platform/image-encoders/skia/PNGImageEncoder.h"
50 #include "platform/image-encoders/skia/WEBPImageEncoder.h" 49 #include "platform/image-encoders/skia/WEBPImageEncoder.h"
51 #include "public/platform/Platform.h" 50 #include "public/platform/Platform.h"
52 #include "public/platform/WebExternalTextureMailbox.h" 51 #include "public/platform/WebExternalTextureMailbox.h"
53 #include "public/platform/WebGraphicsContext3D.h" 52 #include "public/platform/WebGraphicsContext3D.h"
54 #include "public/platform/WebGraphicsContext3DProvider.h" 53 #include "public/platform/WebGraphicsContext3DProvider.h"
55 #include "third_party/skia/include/core/SkPicture.h" 54 #include "third_party/skia/include/core/SkPicture.h"
56 #include "third_party/skia/include/effects/SkTableColorFilter.h" 55 #include "third_party/skia/include/effects/SkTableColorFilter.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 SkBitmap tmp; 162 SkBitmap tmp;
164 if (!bitmap.deepCopyTo(&tmp)) 163 if (!bitmap.deepCopyTo(&tmp))
165 bitmap.copyTo(&tmp, bitmap.colorType()); 164 bitmap.copyTo(&tmp, bitmap.colorType());
166 165
167 return tmp; 166 return tmp;
168 } 167 }
169 168
170 PassRefPtr<Image> ImageBuffer::copyImage(BackingStoreCopy copyBehavior, ScaleBeh avior) const 169 PassRefPtr<Image> ImageBuffer::copyImage(BackingStoreCopy copyBehavior, ScaleBeh avior) const
171 { 170 {
172 if (!isSurfaceValid()) 171 if (!isSurfaceValid())
173 return BitmapImage::create(NativeImageSkia::create()); 172 return BitmapImage::create(SkBitmap());
174 173
175 const SkBitmap& bitmap = m_surface->bitmap(); 174 const SkBitmap& bitmap = m_surface->bitmap();
176 return BitmapImage::create(NativeImageSkia::create(copyBehavior == CopyBacki ngStore ? deepSkBitmapCopy(bitmap) : bitmap)); 175 return BitmapImage::create(copyBehavior == CopyBackingStore ? deepSkBitmapCo py(bitmap) : bitmap);
177 } 176 }
178 177
179 BackingStoreCopy ImageBuffer::fastCopyImageMode() 178 BackingStoreCopy ImageBuffer::fastCopyImageMode()
180 { 179 {
181 return DontCopyBackingStore; 180 return DontCopyBackingStore;
182 } 181 }
183 182
184 WebLayer* ImageBuffer::platformLayer() const 183 WebLayer* ImageBuffer::platformLayer() const
185 { 184 {
186 return m_surface->layer(); 185 return m_surface->layer();
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); 406 ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType));
408 407
409 Vector<char> encodedImage; 408 Vector<char> encodedImage;
410 if (!encodeImage(*this, mimeType, quality, &encodedImage)) 409 if (!encodeImage(*this, mimeType, quality, &encodedImage))
411 return "data:,"; 410 return "data:,";
412 411
413 return "data:" + mimeType + ";base64," + base64Encode(encodedImage); 412 return "data:" + mimeType + ";base64," + base64Encode(encodedImage);
414 } 413 }
415 414
416 } // namespace blink 415 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698