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

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

Issue 7206016: Convert most remaining resources to use the API/thunk system. The significant (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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 // 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/plugins/ppapi/ppb_flash_impl.h" 5 #include "webkit/plugins/ppapi/ppb_flash_impl.h"
6 6
7 #include "skia/ext/platform_canvas.h" 7 #include "skia/ext/platform_canvas.h"
8 #include "ppapi/c/pp_point.h" 8 #include "ppapi/c/pp_point.h"
9 #include "ppapi/c/pp_rect.h" 9 #include "ppapi/c/pp_rect.h"
10 #include "ppapi/c/dev/ppb_font_dev.h" 10 #include "ppapi/c/dev/ppb_font_dev.h"
11 #include "ppapi/thunk/enter.h"
11 #include "third_party/skia/include/core/SkCanvas.h" 12 #include "third_party/skia/include/core/SkCanvas.h"
12 #include "third_party/skia/include/core/SkMatrix.h" 13 #include "third_party/skia/include/core/SkMatrix.h"
13 #include "third_party/skia/include/core/SkPaint.h" 14 #include "third_party/skia/include/core/SkPaint.h"
14 #include "third_party/skia/include/core/SkPoint.h" 15 #include "third_party/skia/include/core/SkPoint.h"
15 #include "third_party/skia/include/core/SkTemplates.h" 16 #include "third_party/skia/include/core/SkTemplates.h"
16 #include "third_party/skia/include/core/SkTypeface.h" 17 #include "third_party/skia/include/core/SkTypeface.h"
17 #include "webkit/plugins/ppapi/ppb_image_data_impl.h" 18 #include "webkit/plugins/ppapi/ppb_image_data_impl.h"
18 #include "webkit/plugins/ppapi/var.h" 19 #include "webkit/plugins/ppapi/var.h"
19 20
21 using ppapi::thunk::EnterResource;
22 using ppapi::thunk::PPB_ImageData_API;
23
20 namespace webkit { 24 namespace webkit {
21 namespace ppapi { 25 namespace ppapi {
22 26
23 PP_Bool PPB_Flash_Impl::DrawGlyphs(PP_Instance, 27 PP_Bool PPB_Flash_Impl::DrawGlyphs(PP_Instance,
24 PP_Resource pp_image_data, 28 PP_Resource pp_image_data,
25 const PP_FontDescription_Dev* font_desc, 29 const PP_FontDescription_Dev* font_desc,
26 uint32_t color, 30 uint32_t color,
27 PP_Point position, 31 PP_Point position,
28 PP_Rect clip, 32 PP_Rect clip,
29 const float transformation[3][3], 33 const float transformation[3][3],
30 uint32_t glyph_count, 34 uint32_t glyph_count,
31 const uint16_t glyph_indices[], 35 const uint16_t glyph_indices[],
32 const PP_Point glyph_advances[]) { 36 const PP_Point glyph_advances[]) {
33 scoped_refptr<PPB_ImageData_Impl> image_resource( 37 EnterResource<PPB_ImageData_API> enter(pp_image_data, true);
34 Resource::GetAs<PPB_ImageData_Impl>(pp_image_data)); 38 if (enter.failed())
35 if (!image_resource.get())
36 return PP_FALSE; 39 return PP_FALSE;
40 PPB_ImageData_Impl* image_resource =
41 static_cast<PPB_ImageData_Impl*>(enter.object());
42
37 ImageDataAutoMapper mapper(image_resource); 43 ImageDataAutoMapper mapper(image_resource);
38 if (!mapper.is_valid()) 44 if (!mapper.is_valid())
39 return PP_FALSE; 45 return PP_FALSE;
40 46
41 // Set up the typeface. 47 // Set up the typeface.
42 scoped_refptr<StringVar> face_name(StringVar::FromPPVar(font_desc->face)); 48 scoped_refptr<StringVar> face_name(StringVar::FromPPVar(font_desc->face));
43 if (!face_name) 49 if (!face_name)
44 return PP_FALSE; 50 return PP_FALSE;
45 int style = SkTypeface::kNormal; 51 int style = SkTypeface::kNormal;
46 if (font_desc->weight >= PP_FONTWEIGHT_BOLD) 52 if (font_desc->weight >= PP_FONTWEIGHT_BOLD)
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 110
105 canvas->drawPosText(glyph_indices, glyph_count * 2, sk_positions, paint); 111 canvas->drawPosText(glyph_indices, glyph_count * 2, sk_positions, paint);
106 112
107 canvas->restore(); 113 canvas->restore();
108 return PP_TRUE; 114 return PP_TRUE;
109 } 115 }
110 116
111 } // namespace ppapi 117 } // namespace ppapi
112 } // namespace webkit 118 } // namespace webkit
113 119
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698