Commit eb91daf3 authored by fmalita's avatar fmalita Committed by Commit bot

Remove skia::DrawToNativeContext()

It has only one client.  Inline the implementation (and simplify, as the
optional src_rect param is always present).

BUG=675977
R=reed@google.com,robertphillips@chromium.org
TBR=danakj@chromium.org

Review-Url: https://codereview.chromium.org/2610323004
Cr-Commit-Position: refs/heads/master@{#442030}
parent 21adf48e
......@@ -9,6 +9,7 @@
#include "cc/resources/shared_bitmap.h"
#include "content/public/browser/browser_thread.h"
#include "skia/ext/platform_canvas.h"
#include "skia/ext/skia_utils_win.h"
#include "ui/compositor/compositor.h"
#include "ui/gfx/gdi_util.h"
#include "ui/gfx/skia_util.h"
......@@ -165,6 +166,8 @@ void SoftwareOutputDeviceWin::EndPaint() {
if (rect.IsEmpty())
return;
HDC dib_dc = skia::GetNativeDrawingContext(contents_.get());
if (is_hwnd_composited_) {
RECT wr;
GetWindowRect(hwnd_, &wr);
......@@ -178,14 +181,19 @@ void SoftwareOutputDeviceWin::EndPaint() {
style |= WS_EX_LAYERED;
SetWindowLong(hwnd_, GWL_EXSTYLE, style);
HDC dib_dc = skia::GetNativeDrawingContext(contents_.get());
::UpdateLayeredWindow(hwnd_, NULL, &position, &size, dib_dc, &zero,
RGB(0xFF, 0xFF, 0xFF), &blend, ULW_ALPHA);
} else {
HDC hdc = ::GetDC(hwnd_);
RECT src_rect = rect.ToRECT();
skia::DrawToNativeContext(contents_.get(), hdc, rect.x(), rect.y(),
&src_rect);
skia::CopyHDC(dib_dc,
hdc,
rect.x(),
rect.y(),
contents_.get()->imageInfo().isOpaque(),
src_rect,
contents_.get()->getTotalMatrix());
::ReleaseDC(hwnd_, hdc);
}
}
......
......@@ -33,21 +33,6 @@ void LoadClippingRegionToDC(HDC context,
namespace skia {
void DrawToNativeContext(SkCanvas* canvas, HDC destination_hdc, int x, int y,
const RECT* src_rect) {
RECT temp_rect;
if (!src_rect) {
temp_rect.left = 0;
temp_rect.right = canvas->imageInfo().width();
temp_rect.top = 0;
temp_rect.bottom = canvas->imageInfo().height();
src_rect = &temp_rect;
}
skia::CopyHDC(skia::GetNativeDrawingContext(canvas), destination_hdc, x, y,
canvas->imageInfo().isOpaque(), *src_rect,
canvas->getTotalMatrix());
}
HDC GetNativeDrawingContext(SkCanvas* canvas) {
PlatformDevice* platform_device = GetPlatformDevice(canvas->getTopDevice(true));
if (!platform_device)
......
......@@ -52,16 +52,6 @@ SK_API std::unique_ptr<SkCanvas> CreatePlatformCanvasWithSharedSection(
HANDLE shared_section,
OnFailureType failure_type);
// Draws the top layer of the canvas into the specified HDC. Only works
// with a SkCanvas with a BitmapPlatformDevice. Will create a temporary
// HDC to back the canvas if one doesn't already exist, tearing it down
// before returning. If |src_rect| is null, copies the entire canvas.
SK_API void DrawToNativeContext(SkCanvas* canvas,
HDC hdc,
int x,
int y,
const RECT* src_rect);
// Returns the NativeDrawingContext to use for native platform drawing calls.
SK_API HDC GetNativeDrawingContext(SkCanvas* canvas);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment