зеркало из https://github.com/mozilla/gecko-dev.git
Bug 700179 - Add GetSize() support for the windows surfaces. r=Bas
This commit is contained in:
Родитель
2f7388d5b7
Коммит
760569d977
|
@ -4797,3 +4797,29 @@ cairo_d2d_get_surface_vram_usage(cairo_device_t *device)
|
|||
cairo_d2d_device_t *d2d_device = reinterpret_cast<cairo_d2d_device_t*>(device);
|
||||
return d2d_device->mVRAMUsage;
|
||||
}
|
||||
|
||||
int
|
||||
cairo_d2d_surface_get_width(cairo_surface_t *surface)
|
||||
{
|
||||
if (surface->backend != &cairo_d2d_surface_backend) {
|
||||
_cairo_error_throw (CAIRO_STATUS_SURFACE_TYPE_MISMATCH);
|
||||
return 0;
|
||||
}
|
||||
|
||||
cairo_d2d_surface_t *d2dsurf = reinterpret_cast<cairo_d2d_surface_t*>(surface);
|
||||
D2D1_SIZE_U size = d2dsurf->rt->GetPixelSize();
|
||||
return size.width;
|
||||
}
|
||||
|
||||
int
|
||||
cairo_d2d_surface_get_height(cairo_surface_t *surface)
|
||||
{
|
||||
if (surface->backend != &cairo_d2d_surface_backend) {
|
||||
_cairo_error_throw (CAIRO_STATUS_SURFACE_TYPE_MISMATCH);
|
||||
return 0;
|
||||
}
|
||||
|
||||
cairo_d2d_surface_t *d2dsurf = reinterpret_cast<cairo_d2d_surface_t*>(surface);
|
||||
D2D1_SIZE_U size = d2dsurf->rt->GetPixelSize();
|
||||
return size.height;
|
||||
}
|
||||
|
|
|
@ -3910,3 +3910,23 @@ cairo_win32_surface_get_can_convert_to_dib (cairo_surface_t *asurface, cairo_boo
|
|||
*can_convert = ((surface->flags & CAIRO_WIN32_SURFACE_CAN_CONVERT_TO_DIB) != 0);
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
int
|
||||
cairo_win32_surface_get_width (cairo_surface_t *asurface)
|
||||
{
|
||||
cairo_win32_surface_t *surface = (cairo_win32_surface_t*) asurface;
|
||||
if (surface->base.type != CAIRO_SURFACE_TYPE_WIN32)
|
||||
return CAIRO_STATUS_SURFACE_TYPE_MISMATCH;
|
||||
|
||||
return surface->extents.width;
|
||||
}
|
||||
|
||||
int
|
||||
cairo_win32_surface_get_height (cairo_surface_t *asurface)
|
||||
{
|
||||
cairo_win32_surface_t *surface = (cairo_win32_surface_t*) asurface;
|
||||
if (surface->base.type != CAIRO_SURFACE_TYPE_WIN32)
|
||||
return CAIRO_STATUS_SURFACE_TYPE_MISMATCH;
|
||||
|
||||
return surface->extents.height;
|
||||
}
|
||||
|
|
|
@ -82,6 +82,12 @@ cairo_win32_surface_get_can_convert_to_dib (cairo_surface_t *surface, cairo_bool
|
|||
|
||||
BYTE cairo_win32_get_system_text_quality (void);
|
||||
|
||||
cairo_public int
|
||||
cairo_win32_surface_get_width (cairo_surface_t *surface);
|
||||
|
||||
cairo_public int
|
||||
cairo_win32_surface_get_height (cairo_surface_t *surface);
|
||||
|
||||
#if CAIRO_HAS_WIN32_FONT
|
||||
|
||||
/*
|
||||
|
@ -309,6 +315,16 @@ int cairo_d2d_get_image_surface_cache_usage();
|
|||
* cache.
|
||||
*/
|
||||
int cairo_d2d_get_surface_vram_usage(cairo_device_t *device);
|
||||
|
||||
/**
|
||||
* Get the width of the surface.
|
||||
*/
|
||||
int cairo_d2d_surface_get_width(cairo_surface_t *surface);
|
||||
|
||||
/**
|
||||
* Get the height of the surface.
|
||||
*/
|
||||
int cairo_d2d_surface_get_height(cairo_surface_t *surface);
|
||||
#endif
|
||||
|
||||
CAIRO_END_DECLS
|
||||
|
|
|
@ -123,3 +123,9 @@ gfxD2DSurface::ReleaseDC(const nsIntRect *aUpdatedRect)
|
|||
rect.height = aUpdatedRect->height;
|
||||
cairo_d2d_release_dc(CairoSurface(), &rect);
|
||||
}
|
||||
|
||||
const gfxIntSize gfxD2DSurface::GetSize() const
|
||||
{
|
||||
return gfxIntSize(cairo_d2d_surface_get_width(mSurface),
|
||||
cairo_d2d_surface_get_height(mSurface));
|
||||
}
|
|
@ -70,6 +70,8 @@ public:
|
|||
void Present();
|
||||
void Scroll(const nsIntPoint &aDelta, const nsIntRect &aClip);
|
||||
|
||||
virtual const gfxIntSize GetSize() const;
|
||||
|
||||
ID3D10Texture2D *GetTexture();
|
||||
|
||||
HDC GetDC(bool aRetainContents);
|
||||
|
|
|
@ -337,6 +337,20 @@ gfxWindowsSurface::GetDefaultContextFlags() const
|
|||
return 0;
|
||||
}
|
||||
|
||||
const gfxIntSize
|
||||
gfxWindowsSurface::GetSize() const
|
||||
{
|
||||
if (!mSurfaceValid) {
|
||||
NS_WARNING ("GetImageSurface on an invalid (null) surface; who's calling this without checking for surface errors?");
|
||||
return gfxIntSize(-1, -1);
|
||||
}
|
||||
|
||||
NS_ASSERTION(mSurface != nsnull, "CairoSurface() shouldn't be nsnull when mSurfaceValid is TRUE!");
|
||||
|
||||
return gfxIntSize(cairo_win32_surface_get_width(mSurface),
|
||||
cairo_win32_surface_get_height(mSurface));
|
||||
}
|
||||
|
||||
gfxASurface::MemoryLocation
|
||||
gfxWindowsSurface::GetMemoryLocation() const
|
||||
{
|
||||
|
|
|
@ -92,6 +92,8 @@ public:
|
|||
|
||||
virtual PRInt32 GetDefaultContextFlags() const;
|
||||
|
||||
const gfxIntSize GetSize() const;
|
||||
|
||||
void MovePixels(const nsIntRect& aSourceRect,
|
||||
const nsIntPoint& aDestTopLeft)
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче