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

Side by Side Diff: webkit/plugins/ppapi/ppapi_plugin_instance.cc

Issue 9720040: ui/gfx: Do not use the deprecated SkBitmap::getConfig() function. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | « ui/gfx/skbitmap_operations.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "webkit/plugins/ppapi/ppapi_plugin_instance.h" 5 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/linked_ptr.h" 10 #include "base/memory/linked_ptr.h"
(...skipping 1588 matching lines...) Expand 10 before | Expand all | Expand 10 after
1599 1599
1600 #if defined(OS_WIN) 1600 #if defined(OS_WIN)
1601 bool PluginInstance::DrawJPEGToPlatformDC( 1601 bool PluginInstance::DrawJPEGToPlatformDC(
1602 const SkBitmap& bitmap, 1602 const SkBitmap& bitmap,
1603 const gfx::Rect& printable_area, 1603 const gfx::Rect& printable_area,
1604 WebKit::WebCanvas* canvas) { 1604 WebKit::WebCanvas* canvas) {
1605 // Ideally we should add JPEG compression to the VectorPlatformDevice class 1605 // Ideally we should add JPEG compression to the VectorPlatformDevice class
1606 // However, Skia currently has no JPEG compression code and we cannot 1606 // However, Skia currently has no JPEG compression code and we cannot
1607 // depend on gfx/jpeg_codec.h in Skia. So we do the compression here. 1607 // depend on gfx/jpeg_codec.h in Skia. So we do the compression here.
1608 SkAutoLockPixels lock(bitmap); 1608 SkAutoLockPixels lock(bitmap);
1609 DCHECK(bitmap.getConfig() == SkBitmap::kARGB_8888_Config); 1609 DCHECK(bitmap.config() == SkBitmap::kARGB_8888_Config);
1610 const uint32_t* pixels = 1610 const uint32_t* pixels =
1611 static_cast<const uint32_t*>(bitmap.getPixels()); 1611 static_cast<const uint32_t*>(bitmap.getPixels());
1612 std::vector<unsigned char> compressed_image; 1612 std::vector<unsigned char> compressed_image;
1613 base::TimeTicks start_time = base::TimeTicks::Now(); 1613 base::TimeTicks start_time = base::TimeTicks::Now();
1614 bool encoded = gfx::JPEGCodec::Encode( 1614 bool encoded = gfx::JPEGCodec::Encode(
1615 reinterpret_cast<const unsigned char*>(pixels), 1615 reinterpret_cast<const unsigned char*>(pixels),
1616 gfx::JPEGCodec::FORMAT_BGRA, bitmap.width(), bitmap.height(), 1616 gfx::JPEGCodec::FORMAT_BGRA, bitmap.width(), bitmap.height(),
1617 static_cast<int>(bitmap.rowBytes()), 100, &compressed_image); 1617 static_cast<int>(bitmap.rowBytes()), 100, &compressed_image);
1618 UMA_HISTOGRAM_TIMES("PepperPluginPrint.RasterBitmapCompressTime", 1618 UMA_HISTOGRAM_TIMES("PepperPluginPrint.RasterBitmapCompressTime",
1619 base::TimeTicks::Now() - start_time); 1619 base::TimeTicks::Now() - start_time);
(...skipping 19 matching lines...) Expand all
1639 return true; 1639 return true;
1640 } 1640 }
1641 #endif // OS_WIN 1641 #endif // OS_WIN
1642 1642
1643 #if defined(OS_MACOSX) && !defined(USE_SKIA) 1643 #if defined(OS_MACOSX) && !defined(USE_SKIA)
1644 void PluginInstance::DrawSkBitmapToCanvas( 1644 void PluginInstance::DrawSkBitmapToCanvas(
1645 const SkBitmap& bitmap, WebKit::WebCanvas* canvas, 1645 const SkBitmap& bitmap, WebKit::WebCanvas* canvas,
1646 const gfx::Rect& dest_rect, 1646 const gfx::Rect& dest_rect,
1647 int canvas_height) { 1647 int canvas_height) {
1648 SkAutoLockPixels lock(bitmap); 1648 SkAutoLockPixels lock(bitmap);
1649 DCHECK(bitmap.getConfig() == SkBitmap::kARGB_8888_Config); 1649 DCHECK(bitmap.config() == SkBitmap::kARGB_8888_Config);
1650 base::mac::ScopedCFTypeRef<CGDataProviderRef> data_provider( 1650 base::mac::ScopedCFTypeRef<CGDataProviderRef> data_provider(
1651 CGDataProviderCreateWithData( 1651 CGDataProviderCreateWithData(
1652 NULL, bitmap.getAddr32(0, 0), 1652 NULL, bitmap.getAddr32(0, 0),
1653 bitmap.rowBytes() * bitmap.height(), NULL)); 1653 bitmap.rowBytes() * bitmap.height(), NULL));
1654 base::mac::ScopedCFTypeRef<CGImageRef> image( 1654 base::mac::ScopedCFTypeRef<CGImageRef> image(
1655 CGImageCreate( 1655 CGImageCreate(
1656 bitmap.width(), bitmap.height(), 1656 bitmap.width(), bitmap.height(),
1657 8, 32, bitmap.rowBytes(), 1657 8, 32, bitmap.rowBytes(),
1658 base::mac::GetSystemColorSpace(), 1658 base::mac::GetSystemColorSpace(),
1659 kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host, 1659 kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host,
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
2168 screen_size_for_fullscreen_ = gfx::Size(); 2168 screen_size_for_fullscreen_ = gfx::Size();
2169 WebElement element = container_->element(); 2169 WebElement element = container_->element();
2170 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); 2170 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_);
2171 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); 2171 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_);
2172 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); 2172 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_);
2173 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); 2173 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_);
2174 } 2174 }
2175 2175
2176 } // namespace ppapi 2176 } // namespace ppapi
2177 } // namespace webkit 2177 } // namespace webkit
OLDNEW
« no previous file with comments | « ui/gfx/skbitmap_operations.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698