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

Side by Side Diff: printing/emf_win.cc

Issue 2823003002: SkBitmap and SkPixelRef no longer need lock/unlock (Closed)
Patch Set: win fix after rebase Created 3 years, 8 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
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 "printing/emf_win.h" 5 #include "printing/emf_win.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 play_normally = false; 375 play_normally = false;
376 bitmap = base::MakeUnique<SkBitmap>(); 376 bitmap = base::MakeUnique<SkBitmap>();
377 gfx::PNGCodec::Decode(bits, bmih->biSizeImage, bitmap.get()); 377 gfx::PNGCodec::Decode(bits, bmih->biSizeImage, bitmap.get());
378 } 378 }
379 } 379 }
380 if (play_normally) { 380 if (play_normally) {
381 res = Play(context); 381 res = Play(context);
382 } else { 382 } else {
383 DCHECK(bitmap.get()); 383 DCHECK(bitmap.get());
384 if (bitmap.get()) { 384 if (bitmap.get()) {
385 SkAutoLockPixels lock(*bitmap.get());
386 DCHECK_EQ(bitmap->colorType(), kN32_SkColorType); 385 DCHECK_EQ(bitmap->colorType(), kN32_SkColorType);
387 const uint32_t* pixels = 386 const uint32_t* pixels =
388 static_cast<const uint32_t*>(bitmap->getPixels()); 387 static_cast<const uint32_t*>(bitmap->getPixels());
389 if (!pixels) { 388 if (!pixels) {
390 NOTREACHED(); 389 NOTREACHED();
391 return false; 390 return false;
392 } 391 }
393 BITMAPINFOHEADER bmi = {0}; 392 BITMAPINFOHEADER bmi = {0};
394 skia::CreateBitmapHeader(bitmap->width(), bitmap->height(), &bmi); 393 skia::CreateBitmapHeader(bitmap->width(), bitmap->height(), &bmi);
395 res = (0 != StretchDIBits(hdc, sdib_record->xDest, sdib_record->yDest, 394 res = (0 != StretchDIBits(hdc, sdib_record->xDest, sdib_record->yDest,
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 594
596 HDC bitmap_dc = bitmap.context(); 595 HDC bitmap_dc = bitmap.context();
597 RECT rect = page_bounds.ToRECT(); 596 RECT rect = page_bounds.ToRECT();
598 ::EnumEnhMetaFile(hdc, emf(), &RasterizeAlphaBlendProc, &bitmap_dc, &rect); 597 ::EnumEnhMetaFile(hdc, emf(), &RasterizeAlphaBlendProc, &bitmap_dc, &rect);
599 598
600 result->FinishDocument(); 599 result->FinishDocument();
601 return result; 600 return result;
602 } 601 }
603 602
604 } // namespace printing 603 } // namespace printing
OLDNEW
« no previous file with comments | « media/renderers/skcanvas_video_renderer_unittest.cc ('k') | remoting/host/chromeos/skia_bitmap_desktop_frame.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698