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

Side by Side Diff: Source/platform/graphics/test/MockDiscardablePixelRef.h

Issue 307813004: deprecate asImageInfo (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add & Created 6 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
« no previous file with comments | « Source/platform/graphics/ImageFrameGenerator.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 void discard() 45 void discard()
46 { 46 {
47 ASSERT(!m_lockedMemory); 47 ASSERT(!m_lockedMemory);
48 discarded = true; 48 discarded = true;
49 } 49 }
50 50
51 class Allocator : public SkBitmap::Allocator { 51 class Allocator : public SkBitmap::Allocator {
52 public: 52 public:
53 virtual bool allocPixelRef(SkBitmap* dst, SkColorTable* ct) SK_OVERRIDE { 53 virtual bool allocPixelRef(SkBitmap* dst, SkColorTable* ct) SK_OVERRIDE {
54 SkImageInfo info; 54 const SkImageInfo& info = dst->info();
55 if (!dst->asImageInfo(&info)) { 55 if (kUnknown_SkColorType == info.colorType())
56 return false; 56 return false;
57 }
58 SkAutoTUnref<SkPixelRef> pr(new MockDiscardablePixelRef(info, dst->r owBytes())); 57 SkAutoTUnref<SkPixelRef> pr(new MockDiscardablePixelRef(info, dst->r owBytes()));
59 dst->setPixelRef(pr); 58 dst->setPixelRef(pr);
60 return true; 59 return true;
61 } 60 }
62 }; 61 };
63 62
64 SK_DECLARE_UNFLATTENABLE_OBJECT() 63 SK_DECLARE_UNFLATTENABLE_OBJECT()
65 64
66 protected: 65 protected:
67 virtual bool onNewLockPixels(LockRec* rec) 66 virtual bool onNewLockPixels(LockRec* rec)
(...skipping 14 matching lines...) Expand all
82 81
83 private: 82 private:
84 void* m_lockedMemory; 83 void* m_lockedMemory;
85 size_t m_rowBytes; 84 size_t m_rowBytes;
86 bool discarded; 85 bool discarded;
87 }; 86 };
88 87
89 } // namespace WebCore 88 } // namespace WebCore
90 89
91 #endif // MockDiscardablePixelRef_h 90 #endif // MockDiscardablePixelRef_h
OLDNEW
« no previous file with comments | « Source/platform/graphics/ImageFrameGenerator.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698