mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 02:14:43 +00:00
Bug 1338086 - Remove useless else blocks in order to reduce complexity in gfx/ r=nical
MozReview-Commit-ID: H9zZd19V4Ww --HG-- extra : rebase_source : e0d736b23d81a9ae511fc230f01103ea772f651a
This commit is contained in:
parent
6adbd4e7f3
commit
6d3ed37df9
@ -385,12 +385,12 @@ SkImageIsMask(const sk_sp<SkImage>& aImage)
|
||||
if (aImage->peekPixels(&pixmap)) {
|
||||
return pixmap.colorType() == kAlpha_8_SkColorType;
|
||||
#ifdef USE_SKIA_GPU
|
||||
} else if (GrTexture* tex = aImage->getTexture()) {
|
||||
}
|
||||
if (GrTexture* tex = aImage->getTexture()) {
|
||||
return GrPixelConfigIsAlphaOnly(tex->config());
|
||||
#endif
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool
|
||||
|
@ -193,11 +193,12 @@ SkBitmap ImageOperations::Resize(const SkBitmap& source,
|
||||
int dest_width, int dest_height,
|
||||
const SkIRect& dest_subset,
|
||||
void* dest_pixels /* = nullptr */) {
|
||||
if (method == ImageOperations::RESIZE_SUBPIXEL)
|
||||
if (method == ImageOperations::RESIZE_SUBPIXEL) {
|
||||
return ResizeSubpixel(source, dest_width, dest_height, dest_subset);
|
||||
else
|
||||
return ResizeBasic(source, method, dest_width, dest_height, dest_subset,
|
||||
dest_pixels);
|
||||
}
|
||||
|
||||
return ResizeBasic(source, method, dest_width, dest_height, dest_subset,
|
||||
dest_pixels);
|
||||
}
|
||||
|
||||
// static
|
||||
|
@ -58,9 +58,8 @@ glGetString_mozilla(GLContext* aContext, GrGLenum aName)
|
||||
if (aName == LOCAL_GL_VERSION) {
|
||||
if (aContext->IsGLES()) {
|
||||
return reinterpret_cast<const GLubyte*>("OpenGL ES 2.0");
|
||||
} else {
|
||||
return reinterpret_cast<const GLubyte*>("2.0");
|
||||
}
|
||||
return reinterpret_cast<const GLubyte*>("2.0");
|
||||
} else if (aName == LOCAL_GL_EXTENSIONS) {
|
||||
// Only expose the bare minimum extensions we want to support to ensure a functional Ganesh
|
||||
// as GLContext only exposes certain extensions
|
||||
@ -130,9 +129,8 @@ glGetString_mozilla(GLContext* aContext, GrGLenum aName)
|
||||
} else if (aName == LOCAL_GL_SHADING_LANGUAGE_VERSION) {
|
||||
if (aContext->IsGLES()) {
|
||||
return reinterpret_cast<const GLubyte*>("OpenGL ES GLSL ES 1.0");
|
||||
} else {
|
||||
return reinterpret_cast<const GLubyte*>("1.10");
|
||||
}
|
||||
return reinterpret_cast<const GLubyte*>("1.10");
|
||||
}
|
||||
|
||||
return aContext->fGetString(aName);
|
||||
|
@ -783,21 +783,21 @@ LayerPropertiesBase::ComputeDifferences(Layer* aRoot, NotifySubDocInvalidationFu
|
||||
} else {
|
||||
ClearInvalidations(aRoot);
|
||||
}
|
||||
IntRect result = TransformRect(aRoot->GetLocalVisibleRegion().ToUnknownRegion().GetBounds(),
|
||||
aRoot->GetLocalTransform());
|
||||
IntRect result = TransformRect(
|
||||
aRoot->GetLocalVisibleRegion().ToUnknownRegion().GetBounds(),
|
||||
aRoot->GetLocalTransform());
|
||||
result = result.Union(OldTransformedBounds());
|
||||
if (aGeometryChanged != nullptr) {
|
||||
*aGeometryChanged = true;
|
||||
}
|
||||
return result;
|
||||
} else {
|
||||
bool geometryChanged = (aGeometryChanged != nullptr) ? *aGeometryChanged : false;
|
||||
nsIntRegion invalid = ComputeChange(" ", aCallback, geometryChanged);
|
||||
if (aGeometryChanged != nullptr) {
|
||||
*aGeometryChanged = geometryChanged;
|
||||
}
|
||||
return invalid;
|
||||
}
|
||||
bool geometryChanged = (aGeometryChanged != nullptr) ? *aGeometryChanged : false;
|
||||
nsIntRegion invalid = ComputeChange(" ", aCallback, geometryChanged);
|
||||
if (aGeometryChanged != nullptr) {
|
||||
*aGeometryChanged = geometryChanged;
|
||||
}
|
||||
return invalid;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -670,10 +670,10 @@ Layer::GetTransformTyped() const
|
||||
Matrix4x4
|
||||
Layer::GetLocalTransform()
|
||||
{
|
||||
if (HostLayer* shadow = AsHostLayer())
|
||||
if (HostLayer* shadow = AsHostLayer()) {
|
||||
return shadow->GetShadowTransform();
|
||||
else
|
||||
return GetTransform();
|
||||
}
|
||||
return GetTransform();
|
||||
}
|
||||
|
||||
const LayerToParentLayerMatrix4x4
|
||||
@ -1136,10 +1136,8 @@ ContainerLayer::Collect3DContextLeaves(nsTArray<Layer*>& aToSort)
|
||||
!container->UseIntermediateSurface())) {
|
||||
return TraversalFlag::Continue;
|
||||
}
|
||||
else {
|
||||
aToSort.AppendElement(layer);
|
||||
return TraversalFlag::Skip;
|
||||
}
|
||||
aToSort.AppendElement(layer);
|
||||
return TraversalFlag::Skip;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -83,9 +83,8 @@ X11DataTextureSourceBasic::GetSize() const
|
||||
if (!mBufferDrawTarget) {
|
||||
NS_WARNING("Trying to query the size of an uninitialized TextureSource");
|
||||
return IntSize(0, 0);
|
||||
} else {
|
||||
return mBufferDrawTarget->GetSize();
|
||||
}
|
||||
return mBufferDrawTarget->GetSize();
|
||||
}
|
||||
|
||||
gfx::SurfaceFormat
|
||||
@ -94,9 +93,8 @@ X11DataTextureSourceBasic::GetFormat() const
|
||||
if (!mBufferDrawTarget) {
|
||||
NS_WARNING("Trying to query the format of an uninitialized TextureSource");
|
||||
return gfx::SurfaceFormat::UNKNOWN;
|
||||
} else {
|
||||
return mBufferDrawTarget->GetFormat();
|
||||
}
|
||||
return mBufferDrawTarget->GetFormat();
|
||||
}
|
||||
|
||||
SourceSurface*
|
||||
@ -106,9 +104,8 @@ X11DataTextureSourceBasic::GetSurface(DrawTarget* aTarget)
|
||||
if (mBufferDrawTarget) {
|
||||
surface = mBufferDrawTarget->Snapshot();
|
||||
return surface.get();
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -81,11 +81,10 @@ gfxASurface::AddRef(void)
|
||||
}
|
||||
|
||||
return (nsrefcnt) cairo_surface_get_reference_count(mSurface);
|
||||
} else {
|
||||
// the surface isn't valid, but we still need to refcount
|
||||
// the gfxASurface
|
||||
return ++mFloatingRefs;
|
||||
}
|
||||
// the surface isn't valid, but we still need to refcount
|
||||
// the gfxASurface
|
||||
return ++mFloatingRefs;
|
||||
}
|
||||
|
||||
nsrefcnt
|
||||
@ -103,14 +102,12 @@ gfxASurface::Release(void)
|
||||
// |this| may not be valid any more, don't use it!
|
||||
|
||||
return --refcnt;
|
||||
} else {
|
||||
if (--mFloatingRefs == 0) {
|
||||
delete this;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return mFloatingRefs;
|
||||
}
|
||||
if (--mFloatingRefs == 0) {
|
||||
delete this;
|
||||
return 0;
|
||||
}
|
||||
return mFloatingRefs;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -134,29 +134,37 @@ GetFaceNames(FcPattern* aFont, const nsAString& aFamilyName,
|
||||
static uint16_t
|
||||
MapFcWeight(int aFcWeight)
|
||||
{
|
||||
if (aFcWeight <= (FC_WEIGHT_THIN + FC_WEIGHT_EXTRALIGHT) / 2) {
|
||||
return 100;
|
||||
} else if (aFcWeight <= (FC_WEIGHT_EXTRALIGHT + FC_WEIGHT_LIGHT) / 2) {
|
||||
return 200;
|
||||
} else if (aFcWeight <= (FC_WEIGHT_LIGHT + FC_WEIGHT_BOOK) / 2) {
|
||||
return 300;
|
||||
} else if (aFcWeight <= (FC_WEIGHT_REGULAR + FC_WEIGHT_MEDIUM) / 2) {
|
||||
// This includes FC_WEIGHT_BOOK
|
||||
return 400;
|
||||
} else if (aFcWeight <= (FC_WEIGHT_MEDIUM + FC_WEIGHT_DEMIBOLD) / 2) {
|
||||
return 500;
|
||||
} else if (aFcWeight <= (FC_WEIGHT_DEMIBOLD + FC_WEIGHT_BOLD) / 2) {
|
||||
return 600;
|
||||
} else if (aFcWeight <= (FC_WEIGHT_BOLD + FC_WEIGHT_EXTRABOLD) / 2) {
|
||||
return 700;
|
||||
} else if (aFcWeight <= (FC_WEIGHT_EXTRABOLD + FC_WEIGHT_BLACK) / 2) {
|
||||
return 800;
|
||||
} else if (aFcWeight <= FC_WEIGHT_BLACK) {
|
||||
return 900;
|
||||
}
|
||||
if (aFcWeight <= (FC_WEIGHT_THIN + FC_WEIGHT_EXTRALIGHT) / 2) {
|
||||
return 100;
|
||||
}
|
||||
if (aFcWeight <= (FC_WEIGHT_EXTRALIGHT + FC_WEIGHT_LIGHT) / 2) {
|
||||
return 200;
|
||||
}
|
||||
if (aFcWeight <= (FC_WEIGHT_LIGHT + FC_WEIGHT_BOOK) / 2) {
|
||||
return 300;
|
||||
}
|
||||
if (aFcWeight <= (FC_WEIGHT_REGULAR + FC_WEIGHT_MEDIUM) / 2) {
|
||||
// This includes FC_WEIGHT_BOOK
|
||||
return 400;
|
||||
}
|
||||
if (aFcWeight <= (FC_WEIGHT_MEDIUM + FC_WEIGHT_DEMIBOLD) / 2) {
|
||||
return 500;
|
||||
}
|
||||
if (aFcWeight <= (FC_WEIGHT_DEMIBOLD + FC_WEIGHT_BOLD) / 2) {
|
||||
return 600;
|
||||
}
|
||||
if (aFcWeight <= (FC_WEIGHT_BOLD + FC_WEIGHT_EXTRABOLD) / 2) {
|
||||
return 700;
|
||||
}
|
||||
if (aFcWeight <= (FC_WEIGHT_EXTRABOLD + FC_WEIGHT_BLACK) / 2) {
|
||||
return 800;
|
||||
}
|
||||
if (aFcWeight <= FC_WEIGHT_BLACK) {
|
||||
return 900;
|
||||
}
|
||||
|
||||
// including FC_WEIGHT_EXTRABLACK
|
||||
return 901;
|
||||
// including FC_WEIGHT_EXTRABLACK
|
||||
return 901;
|
||||
}
|
||||
|
||||
static int16_t
|
||||
|
@ -1428,11 +1428,9 @@ gfxPlatform::CreateDrawTargetForBackend(BackendType aBackend, const IntSize& aSi
|
||||
if (!surf || surf->CairoStatus()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return CreateDrawTargetForSurface(surf, aSize);
|
||||
} else {
|
||||
return Factory::CreateDrawTarget(aBackend, aSize, aFormat);
|
||||
}
|
||||
return Factory::CreateDrawTarget(aBackend, aSize, aFormat);
|
||||
}
|
||||
|
||||
already_AddRefed<DrawTarget>
|
||||
|
@ -411,11 +411,12 @@ gfxPlatformGtk::GetDPIScale()
|
||||
int32_t dpi = GetDPI();
|
||||
if (dpi < 132) {
|
||||
return 1.0;
|
||||
} else if (dpi < 168) {
|
||||
return 1.5;
|
||||
} else {
|
||||
return round(dpi/96.0);
|
||||
}
|
||||
if (dpi < 168) {
|
||||
return 1.5;
|
||||
}
|
||||
return round(dpi/96.0);
|
||||
|
||||
}
|
||||
|
||||
bool
|
||||
|
Loading…
Reference in New Issue
Block a user