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

Side by Side Diff: chrome/renderer/webview_color_overlay.cc

Issue 10392018: remove WEBKIT_USING_CG (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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 | « no previous file | content/renderer/render_view_impl.cc » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/renderer/webview_color_overlay.h" 5 #include "chrome/renderer/webview_color_overlay.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/public/renderer/render_view.h" 8 #include "content/public/renderer/render_view.h"
9 #include "third_party/skia/include/core/SkCanvas.h" 9 #include "third_party/skia/include/core/SkCanvas.h"
10 #include "third_party/skia/include/core/SkPaint.h" 10 #include "third_party/skia/include/core/SkPaint.h"
11 #include "third_party/skia/include/core/SkRect.h" 11 #include "third_party/skia/include/core/SkRect.h"
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
13 #include "ui/gfx/size.h" 13 #include "ui/gfx/size.h"
14 #include "ui/gfx/skia_util.h" 14 #include "ui/gfx/skia_util.h"
15 15
16 #if WEBKIT_USING_CG
17 #include "skia/ext/skia_utils_mac.h"
18 #endif
19
20 WebViewColorOverlay::WebViewColorOverlay(content::RenderView* render_view, 16 WebViewColorOverlay::WebViewColorOverlay(content::RenderView* render_view,
21 SkColor color) 17 SkColor color)
22 : render_view_(render_view), 18 : render_view_(render_view),
23 color_(color) { 19 color_(color) {
24 render_view_->GetWebView()->addPageOverlay(this, 0); 20 render_view_->GetWebView()->addPageOverlay(this, 0);
25 } 21 }
26 22
27 WebViewColorOverlay::~WebViewColorOverlay() { 23 WebViewColorOverlay::~WebViewColorOverlay() {
28 if (render_view_->GetWebView()) 24 if (render_view_->GetWebView())
29 render_view_->GetWebView()->removePageOverlay(this); 25 render_view_->GetWebView()->removePageOverlay(this);
30 } 26 }
31 27
32 void WebViewColorOverlay::paintPageOverlay(WebKit::WebCanvas* canvas) { 28 void WebViewColorOverlay::paintPageOverlay(WebKit::WebCanvas* canvas) {
33 SkRect rect = gfx::RectToSkRect(gfx::Rect(render_view_->GetSize())); 29 SkRect rect = gfx::RectToSkRect(gfx::Rect(render_view_->GetSize()));
34
35 #if WEBKIT_USING_SKIA
36 SkPaint paint; 30 SkPaint paint;
37 paint.setColor(color_); 31 paint.setColor(color_);
38 paint.setStyle(SkPaint::kFill_Style); 32 paint.setStyle(SkPaint::kFill_Style);
39 canvas->drawRect(rect, paint); 33 canvas->drawRect(rect, paint);
40 #elif WEBKIT_USING_CG
41 CGContextSaveGState(canvas);
42 CGColorRef color = gfx::SkColorToCGColorRef(color_);
43 CGContextSetFillColorWithColor(canvas, color);
44 CGColorRelease(color);
45 CGContextFillRect(canvas, gfx::SkRectToCGRect(rect));
46 CGContextRestoreGState(canvas);
47 #else
48 NOTIMPLEMENTED();
49 #endif
50 } 34 }
OLDNEW
« no previous file with comments | « no previous file | content/renderer/render_view_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698