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

Side by Side Diff: core/fxge/include/fx_ge.h

Issue 2163103002: Use smart pointers for graphics device classes (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: fix all platforms Created 4 years, 5 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 | « core/fxge/include/fx_dib.h ('k') | core/fxge/skia/fx_skia_device.cpp » ('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 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium 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 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #ifndef CORE_FXGE_INCLUDE_FX_GE_H_ 7 #ifndef CORE_FXGE_INCLUDE_FX_GE_H_
8 #define CORE_FXGE_INCLUDE_FX_GE_H_ 8 #define CORE_FXGE_INCLUDE_FX_GE_H_
9 9
10 #include <memory> 10 #include <memory>
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 uint32_t m_ExtGID; 207 uint32_t m_ExtGID;
208 #endif 208 #endif
209 bool m_bFontStyle; 209 bool m_bFontStyle;
210 }; 210 };
211 211
212 class CFX_RenderDevice { 212 class CFX_RenderDevice {
213 public: 213 public:
214 CFX_RenderDevice(); 214 CFX_RenderDevice();
215 virtual ~CFX_RenderDevice(); 215 virtual ~CFX_RenderDevice();
216 216
217 void Flush(); 217 // Take ownership of |pDriver|.
218 void SetDeviceDriver(IFX_RenderDeviceDriver* pDriver); 218 void SetDeviceDriver(std::unique_ptr<IFX_RenderDeviceDriver> pDriver);
219 IFX_RenderDeviceDriver* GetDeviceDriver() const { return m_pDeviceDriver; } 219 IFX_RenderDeviceDriver* GetDeviceDriver() const {
220 return m_pDeviceDriver.get();
221 }
220 222
221 FX_BOOL StartRendering(); 223 FX_BOOL StartRendering();
222 void EndRendering(); 224 void EndRendering();
223 void SaveState(); 225 void SaveState();
224 void RestoreState(bool bKeepSaved); 226 void RestoreState(bool bKeepSaved);
225 227
226 int GetWidth() const { return m_Width; } 228 int GetWidth() const { return m_Width; }
227 int GetHeight() const { return m_Height; } 229 int GetHeight() const { return m_Height; }
228 int GetDeviceClass() const { return m_DeviceClass; } 230 int GetDeviceClass() const { return m_DeviceClass; }
229 int GetBPP() const { return m_bpp; } 231 int GetBPP() const { return m_bpp; }
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 int fill_mode, 395 int fill_mode,
394 int blend_type); 396 int blend_type);
395 397
396 CFX_DIBitmap* m_pBitmap; 398 CFX_DIBitmap* m_pBitmap;
397 int m_Width; 399 int m_Width;
398 int m_Height; 400 int m_Height;
399 int m_bpp; 401 int m_bpp;
400 int m_RenderCaps; 402 int m_RenderCaps;
401 int m_DeviceClass; 403 int m_DeviceClass;
402 FX_RECT m_ClipBox; 404 FX_RECT m_ClipBox;
403 IFX_RenderDeviceDriver* m_pDeviceDriver; 405 std::unique_ptr<IFX_RenderDeviceDriver> m_pDeviceDriver;
404 }; 406 };
405 407
406 class CFX_FxgeDevice : public CFX_RenderDevice { 408 class CFX_FxgeDevice : public CFX_RenderDevice {
407 public: 409 public:
408 CFX_FxgeDevice(); 410 CFX_FxgeDevice();
409 ~CFX_FxgeDevice() override; 411 ~CFX_FxgeDevice() override;
410 412
411 bool Attach(CFX_DIBitmap* pBitmap, 413 bool Attach(CFX_DIBitmap* pBitmap,
412 bool bRgbByteOrder, 414 bool bRgbByteOrder,
413 CFX_DIBitmap* pOriDevice, 415 CFX_DIBitmap* pOriDevice,
414 bool bGroupKnockout); 416 bool bGroupKnockout);
415 bool Create(int width, 417 bool Create(int width,
416 int height, 418 int height,
417 FXDIB_Format format, 419 FXDIB_Format format,
418 CFX_DIBitmap* pOriDevice); 420 CFX_DIBitmap* pOriDevice);
419 421
420 #ifdef _SKIA_SUPPORT_ 422 #ifdef _SKIA_SUPPORT_
421 bool AttachRecorder(SkPictureRecorder* recorder); 423 bool AttachRecorder(SkPictureRecorder* recorder);
422 SkPictureRecorder* CreateRecorder(int size_x, int size_y); 424 SkPictureRecorder* CreateRecorder(int size_x, int size_y);
423 void DebugVerifyBitmapIsPreMultiplied() const override; 425 void DebugVerifyBitmapIsPreMultiplied() const override;
424 #endif 426 #endif
425 427
426 protected: 428 protected:
427 bool m_bOwnedBitmap; 429 bool m_bOwnedBitmap;
428 }; 430 };
429 431
430 #endif // CORE_FXGE_INCLUDE_FX_GE_H_ 432 #endif // CORE_FXGE_INCLUDE_FX_GE_H_
OLDNEW
« no previous file with comments | « core/fxge/include/fx_dib.h ('k') | core/fxge/skia/fx_skia_device.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698