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

Side by Side Diff: webkit/glue/plugins/pepper_plugin_instance.cc

Issue 3855001: Move scoped_cftyperef from base to base/mac, use the new namespace, and name ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 2 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 | « webkit/glue/plugins/pepper_graphics_2d.cc ('k') | webkit/glue/plugins/plugin_lib_mac.mm » ('j') | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/glue/plugins/pepper_plugin_instance.h" 5 #include "webkit/glue/plugins/pepper_plugin_instance.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #if defined(OS_MACOSX) 9 #if defined(OS_MACOSX)
10 #include "base/mac_util.h" 10 #include "base/mac_util.h"
11 #include "base/scoped_cftyperef.h" 11 #include "base/mac/scoped_cftyperef.h"
12 #endif 12 #endif
13 #include "base/scoped_ptr.h" 13 #include "base/scoped_ptr.h"
14 #include "base/utf_string_conversions.h" 14 #include "base/utf_string_conversions.h"
15 #include "gfx/rect.h" 15 #include "gfx/rect.h"
16 #if defined(OS_WIN) 16 #if defined(OS_WIN)
17 #include "gfx/codec/jpeg_codec.h" 17 #include "gfx/codec/jpeg_codec.h"
18 #include "gfx/gdi_util.h" 18 #include "gfx/gdi_util.h"
19 #endif 19 #endif
20 #include "gfx/skia_util.h" 20 #include "gfx/skia_util.h"
21 #include "printing/native_metafile.h" 21 #include "printing/native_metafile.h"
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 } 1020 }
1021 #endif // OS_WIN 1021 #endif // OS_WIN
1022 1022
1023 #if defined(OS_MACOSX) 1023 #if defined(OS_MACOSX)
1024 void PluginInstance::DrawSkBitmapToCanvas( 1024 void PluginInstance::DrawSkBitmapToCanvas(
1025 const SkBitmap& bitmap, WebKit::WebCanvas* canvas, 1025 const SkBitmap& bitmap, WebKit::WebCanvas* canvas,
1026 const gfx::Rect& dest_rect, 1026 const gfx::Rect& dest_rect,
1027 int canvas_height) { 1027 int canvas_height) {
1028 SkAutoLockPixels lock(bitmap); 1028 SkAutoLockPixels lock(bitmap);
1029 DCHECK(bitmap.getConfig() == SkBitmap::kARGB_8888_Config); 1029 DCHECK(bitmap.getConfig() == SkBitmap::kARGB_8888_Config);
1030 scoped_cftyperef<CGDataProviderRef> data_provider( 1030 base::mac::ScopedCFTypeRef<CGDataProviderRef> data_provider(
1031 CGDataProviderCreateWithData( 1031 CGDataProviderCreateWithData(
1032 NULL, bitmap.getAddr32(0, 0), 1032 NULL, bitmap.getAddr32(0, 0),
1033 bitmap.rowBytes() * bitmap.height(), NULL)); 1033 bitmap.rowBytes() * bitmap.height(), NULL));
1034 scoped_cftyperef<CGImageRef> image( 1034 base::mac::ScopedCFTypeRef<CGImageRef> image(
1035 CGImageCreate( 1035 CGImageCreate(
1036 bitmap.width(), bitmap.height(), 1036 bitmap.width(), bitmap.height(),
1037 8, 32, bitmap.rowBytes(), 1037 8, 32, bitmap.rowBytes(),
1038 mac_util::GetSystemColorSpace(), 1038 mac_util::GetSystemColorSpace(),
1039 kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host, 1039 kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host,
1040 data_provider, NULL, false, kCGRenderingIntentDefault)); 1040 data_provider, NULL, false, kCGRenderingIntentDefault));
1041 1041
1042 // Flip the transform 1042 // Flip the transform
1043 CGContextSaveGState(canvas); 1043 CGContextSaveGState(canvas);
1044 CGContextTranslateCTM(canvas, 0, canvas_height); 1044 CGContextTranslateCTM(canvas, 0, canvas_height);
1045 CGContextScaleCTM(canvas, 1.0, -1.0); 1045 CGContextScaleCTM(canvas, 1.0, -1.0);
1046 1046
1047 CGRect bounds; 1047 CGRect bounds;
1048 bounds.origin.x = dest_rect.x(); 1048 bounds.origin.x = dest_rect.x();
1049 bounds.origin.y = canvas_height - dest_rect.y() - dest_rect.height(); 1049 bounds.origin.y = canvas_height - dest_rect.y() - dest_rect.height();
1050 bounds.size.width = dest_rect.width(); 1050 bounds.size.width = dest_rect.width();
1051 bounds.size.height = dest_rect.height(); 1051 bounds.size.height = dest_rect.height();
1052 1052
1053 CGContextDrawImage(canvas, bounds, image); 1053 CGContextDrawImage(canvas, bounds, image);
1054 CGContextRestoreGState(canvas); 1054 CGContextRestoreGState(canvas);
1055 } 1055 }
1056 #endif // defined(OS_MACOSX) 1056 #endif // defined(OS_MACOSX)
1057 1057
1058 1058
1059 } // namespace pepper 1059 } // namespace pepper
OLDNEW
« no previous file with comments | « webkit/glue/plugins/pepper_graphics_2d.cc ('k') | webkit/glue/plugins/plugin_lib_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698